Results 1 to 7 of 7
  1. #1
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    Anyone have a little javascript to rotate banner images?

    Thanks

    John

    Once a year, go someplace you've never been before.

    www.teampb.com

  2. #2
    Full Member
    Join Date
    January 18th, 2005
    Posts
    348


    Are you looking for a script that automatically rotates banners during one page display or one that randomly displays a different banner each time the page is refreshed?

    I use one that randomly displays a different banner (up to nine different banners) each time the page is refreshed or visited.

    Gene
    TCS

  3. #3
    ABW Ambassador Andy's Avatar
    Join Date
    January 18th, 2005
    Posts
    4,178
    Have you checked Dynamic Drive? You'd probably find something there that would work for you.

    Andy

    AFFILIATE MARKETING STANDARD: The site upon which the initial action to buy occurs is the site the commission is paid to. Period.

  4. #4
    ABW Ambassador DesignerWiz's Avatar
    Join Date
    January 18th, 2005
    Location
    U.S.A
    Posts
    2,777
    In HEAD area of HTML:

    <!--
    // == ######################## This Script Free To Use Providing This Notice Remains ######################## == //
    // == This Script Has Been In The http://www.DesignerWiz.com Javascript Public Archive Library == //
    // == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == //
    --><script language="JavaScript">
    <!-- Hide from old browsers

    var i = 1;
    banner1= new Image();
    banner1.src = "YOUR IMAGE #1";
    banner2 = new Image();
    banner2.src = "YOUR IMAGE #2";

    links = new Array
    links[1] = "YOUR LINK #1"
    links[2] = "YOUR LINK #2"

    description = new Array
    description[1] = "YOUR DESCRIPTION #1"
    description[2] = "YOUR DESCRIPTION #2"

    function startTime(){

    var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    closeTime=hours*3600+mins*60+secs;
    closeTime+=15; // How many seconds until the next banner rotation
    Timer();

    }

    function Timer(){
    var time= new Date();
    hours= time.getHours();
    mins= time.getMinutes();
    secs= time.getSeconds();
    curTime=hours*3600+mins*60+secs
    if (curTime>=closeTime){
    if (i < 2){ // The number 2 is the amount of banners that you have adjust accordingly
    i++;
    document.banner.src = eval("banner" + i + ".src");
    }
    else{
    i = 1;
    document.banner.src = eval("banner" + i + ".src");
    }
    startTime();
    }
    else{
    window.setTimeout("Timer()",1000)}

    }

    function clickLink(){
    top.location = links[i]
    }

    function descript(){
    window.status = description[i]
    }

    // -->
    </script>

    In BODY tag: <body onLoad="startTime();">

    In BODY area where seen:

    <a href="" onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=''"><img src="YOUR IMAGE #1" border=0 name="banner"></a>


    To add other banners, simply copy the last code like example below:

    banner2 = new Image();
    banner2.src = "YOUR IMAGE #2"; // add more by making code
    banner3 = new Image();
    banner3.src = "YOUR IMAGE #3";

    Same goes for the links[3] = & description[3] =

    Ray Thomas
    DesignerWiz.com CEO
    Development Resource & Javascript Public Archive Center
    http://DesignerWiz.com

  5. #5
    ABW Ambassador John Kruger's Avatar
    Join Date
    January 18th, 2005
    Location
    At my computer
    Posts
    645
    TCS,
    Yes, I am looking for something to rotate the banners when the page is refreshed or visited.

    Ray,
    Thanks, this will get me started.

    John

    Once a year, go someplace you've never been before.

    www.teampb.com

  6. #6
    Member
    Join Date
    January 18th, 2005
    Location
    Las Vegas
    Posts
    87
    I'm looking for something similar to this, but what I'd like to do have code embedded on several pages that pull a banner add from a file. That way, I can change the banner in the file and have it populate on any page that contains the code.

  7. #7
    ABW Ambassador DesignerWiz's Avatar
    Join Date
    January 18th, 2005
    Location
    U.S.A
    Posts
    2,777
    Hello Tomslick,

    I would recommend your using FocalMedia.net "HTML Rotator" free PERL script. You can easily manage your ads through a control panel and each seperate JS caller can be easily managed from the panel. Not to mention that each page then would only need a code that looked like this below:

    <script SRC="http://www.your.com/html/banner1.js"></script>
    <script LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    banner1();
    // -->
    </script>

    If you still want to go straight JS .. we have those in our archive.

    Ray Thomas
    DesignerWiz.com CEO
    Development Resource & Javascript Public Archive Center
    http://DesignerWiz.com

  8. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Banner rotation/creator
    By boningroup in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: December 8th, 2004, 10:17 PM
  2. Banner Rotation ??
    By walton in forum Commission Junction - CJ
    Replies: 2
    Last Post: January 19th, 2004, 03:39 PM
  3. Banner Rotation feature
    By cumbrowski in forum Rakuten LinkShare - LS
    Replies: 3
    Last Post: January 8th, 2003, 06:42 AM
  4. ABW's Banner Rotation
    By Farrukh - Arabian Bazaar in forum Midnight Cafe'
    Replies: 4
    Last Post: November 23rd, 2002, 01:32 AM
  5. Banner Rotation Script or Program
    By johnniebry in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: July 30th, 2002, 04:33 PM

Posting Permissions

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