Link to home
Start Free TrialLog in
Avatar of omanca
omanca

asked on

rolling image

Hi,
I need a js that would change 2 or 3 images based on time (seconds).  More like a banner or so.
Avatar of omanca
omanca

ASKER

ok, I found an answer from google search.  I closed the site and forgot the address.  Here it is anyway

<html>
<head>
<script>
var banners = new Array(
      '1.gif',
      '2.gif');
var linx = new Array(
      'intro.html',
      'intro.html');
var old = 0;
var current = 0;

function init()
{
      if (!document.images) return
      while (current == old)
      {
            current = Math.floor(Math.random()*banners.length);
      }
      old = current;
      document.images['banner'].src = banners[current];
      setTimeout('init()',2000);
}

function sendPage()
{
      location.href = linx[current];
}
</script>
</head>

<body onload="init()">
<a href="javascript:sendpage()"><img
      src="1.gif" name="banner"
      width=100 height=18 border=0></a>
</body>
</html>
i rather suggest u to use ADRotator unction in this case, i think this link would help u how to use ADRotator Effeciently

http://www.w3schools.com/aspnet/control_adrotator.asp

Regards,
Srinivasan S
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial