Results 1 to 6 of 6

Thread: Random Content (for ad banners)

  1. #1
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Random Content (for ad banners)

    1) Script Title: Random Content Order script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ntentorder.htm

    3) Describe problem: I'm trying to put advertisting in my website and thought that this script would be helpful to randomize the banner that is displayed. Only problem is it randomizes the order of multiple content. Is there a variation of this script that will work for my needs?

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

  3. #3
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!

  4. #4
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    okay. not working and I can't figure out why. here is the exact code I have inserted on the page. any suggestions?

    <script language="JavaScript1.2">

    //Random iframe content- &#169; Dynamic Drive (www.dynamicdrive.com)
    //For full source code, and Terms Of use, visit http://dynamicdrive.com
    //This credit MUST stay intact for use

    var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
    var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

    //Specify IFRAME display attributes
    var iframeprops='width=468 height=60 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

    //Specify random URLs to display inside iframe
    var randomcontent=new Array()
    randomcontent[0]="<a href="http://click.linksynergy.com/fs-bin/click?id=G5s9fB6V01s&offerid=47167.10000454&type=4&subid=0"><IMG alt="HearthSong" border="0" src="http://www.hearthsong.com/assets/images/hearthsong/images/affiliates/HS468x60-fall05-text.gif"></a><IMG border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=G5s9fB6V01s&bids=47167.10000454&type=4&subid=0">"
    randomcontent[1]="<A HREF="http://click.linksynergy.com/fs-bin/click?id=G5s9fB6V01s&offerid=88128.10000020&type=4&subid=0"><img src="http://www.homefocusaffiliates.com/images/home/home_468x60.gif" WIDTH=468 HEIGHT=60 border=0></A><IMG border=0 width=1 height=1 src=http://ad.linksynergy.com/fs-bin/show?id=G5s9fB6V01s&bids=88128.10000020&type=4&subid=0>"
    randomcontent[2]="<a href="http://click.linksynergy.com/fs-bin/click?id=G5s9fB6V01s&offerid=115554.10000031&type=4&subid=0"><IMG alt="LEGO Shop at Home" border="0" src="http://cache.lego.com/2057/images/shop/Affiliate/LEGO_SAH_468x60.gif"></a><IMG border="0" width="1" height="1" src="http://ad.linksynergy.com/fs-bin/show?id=G5s9fB6V01s&bids=115554.10000031&type=4&subid=0">"

    //No need to edit after here
    if (ie||dom)
    document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

    function random_iframe(){
    if (ie||dom){
    var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
    iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
    }
    }

    window.onload=random_iframe

    </script>

  5. #5
    Join Date
    Oct 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the problem could be that there are two images trying to be loaded. One is the banner ad image, and the other is a 1x1 pixel image that is used for impression tracking. Let me know if it's possible to keep the impression tracking image.
    Last edited by edk012; 10-10-2006 at 08:37 PM.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In this part (from the demo):

    Code:
    //Specify random URLs to display inside iframe
    var randomcontent=new Array()
    randomcontent[0]="random1.htm"
    randomcontent[1]="random2.htm"
    randomcontent[2]="random3.htm"
    randomcontent[3]="random4.htm"
    You need to specify a page, not HTML code as you have done. If you make up a page, one for each of your banners, you can include whatever you want on each of those pages.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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