www.webdeveloper.com
Results 1 to 3 of 3

Thread: Place ads on other sites with javascript code.

  1. #1
    Join Date
    Aug 2008
    Posts
    9

    Place ads on other sites with javascript code.

    Hey everyone,

    I am trying to create some sort of script in which a user can put it onto their website(different server than mine). This code will then allow advertisements from my server to be displayed on their website in their specified ad area.

    The idea is similar to google adsense, doubleclick, and buysellads.

    Any ideas on how to make this piece of script?

    Any help would be greatly appreciated.

    Thanks.

  2. #2
    Join Date
    Aug 2008
    Posts
    9
    Anyone have any ideas or can lead me in the right direction?

  3. #3
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    add this to page to show the ad:
    Code:
    <script type='text/javascript' src='http://myServer.com/ad1.js'></script>
    inside ad1.js:
    Code:
    function dumpAd(){
      var ad="\
    	  <div onclick='window.open(\"http://myServer.com/ad1.htm\")' style='cursor:pointer;'>		\
    	 <b>Save up to 80&#37;</b><br />		\
    	 Order some of our stuff by May 01, and receive a <u>big</u> discount.	</div>		\
    "; //end ad HTML
    
        document.write(ad);
    }
    
    dumpAd();
    note that to encode HTML, you must use \" instead of just ", and add a \ to the very end of each line.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles