Auto Rotating Banner

Results 1 to 2 of 2

Thread: Auto Rotating Banner

  1. #1
    DeleTS Guest

    Default Auto Rotating Banner

    I have 15 banner ads, and I some code that will rotate through them on my page at a rate of about 1 ever 5 seconds. Someone please help me. <BR><BR>THanks<BR><BR>DeleTS

  2. #2
    chris willey Guest

    Default RE: Auto Rotating Banner

    There are 2 possible answers, depending on what you want to do. If you mean you want the ad to change while somebody is viewing the page, you need to use a javascript timer.<BR><BR>&#060;script language="Javascript"&#062;<BR>&#060;!--<BR>var timerID = null<BR>var timerRunning = false<BR><BR>//preload the images - change these to match your 15 banners<BR>img1 = new Image();<BR>img1.src = "test1.gif";<BR><BR>img2 = new Image();<BR>img2.src = "test2.gif";<BR><BR>img3 = new Image();<BR>img3.src = "test3.gif";<BR><BR>function stopClock() {<BR> if(timerRunning) {<BR> clearTimeout(timerID);<BR> }<BR> timerRunning = false;<BR>}<BR><BR>function startClock() {<BR> stopClock();<BR> setImage();<BR>}<BR><BR>function setImage() {<BR> rNum = parseInt(3 * Math.random() + 1)<BR> if (document.images) {<BR> document.bannerAd.src = "test" + rNum + ".gif";<BR> }<BR> timerID = setTimeout("setImage()",5000);<BR> timerRunning = true;<BR>}<BR>//--&#062;<BR>&#060;/script&#062;<BR><BR>If, on the other hand, you want the banner ad to be randomly chosen each time somebody views the page (but not change while the person is viewing it), use the Ad Rotator component that comes with ASP (<BR><BR>Hope this helps.

Posting Permissions

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