A
Amy
Hi, I finished this script and for some reason there is a delay
every so often in the timing. Sometimes
it seems two take 2 seconds instead of 1.
Can anyone see anything that would slow it down? I sure can't see it.
Thank you very much, Amy <body onload="changelink()"><a href="#"
id="url"></a>
arr = new Array();
arr[0] = ["Link 1","http://www.google.com"];
arr[1] = ["Link 2","http://www.msn.com"];
arr[2] = ["Link 3","http://www.yahoo.com"];
arr[3] = ["Link 4","http://www.google.com"];
arr[4] = ["Link 5","http://www.msn.com"];
arr[5] = ["Link 6","http://www.yahoo.com"];
arr[6] = ["Link 7","http://www.msn.com"];
arr[7] = ["Link 8","http://www.google.com"];
arr[8] = ["Link 9","http://www.yahoo.com"];
arr[9] = ["Link 10","http://www.msn.com"];
arr[10] = ["Link 11","http://www.yahoo.com"];
arr[11] = ["Link 12","http://www.google.com"];
arr[12] = ["Link 13","http://www.msn.com"];
arr[13] = ["Link 14","http://www.yahoo.com"];
arr[14] = ["Link 15","http://www.google.com"];
counter = 0;
function changelink()
{
rand = Math.floor(Math.random()*arr.length);
document.getElementById("url").href = arr[rand][1];
document.getElementById("url").innerHTML = arr[rand][0];
counter++;
if (counter == arr.length)
counter = 0;
}
setInterval('changelink()', 1000);
every so often in the timing. Sometimes
it seems two take 2 seconds instead of 1.
Can anyone see anything that would slow it down? I sure can't see it.
Thank you very much, Amy <body onload="changelink()"><a href="#"
id="url"></a>
arr = new Array();
arr[0] = ["Link 1","http://www.google.com"];
arr[1] = ["Link 2","http://www.msn.com"];
arr[2] = ["Link 3","http://www.yahoo.com"];
arr[3] = ["Link 4","http://www.google.com"];
arr[4] = ["Link 5","http://www.msn.com"];
arr[5] = ["Link 6","http://www.yahoo.com"];
arr[6] = ["Link 7","http://www.msn.com"];
arr[7] = ["Link 8","http://www.google.com"];
arr[8] = ["Link 9","http://www.yahoo.com"];
arr[9] = ["Link 10","http://www.msn.com"];
arr[10] = ["Link 11","http://www.yahoo.com"];
arr[11] = ["Link 12","http://www.google.com"];
arr[12] = ["Link 13","http://www.msn.com"];
arr[13] = ["Link 14","http://www.yahoo.com"];
arr[14] = ["Link 15","http://www.google.com"];
counter = 0;
function changelink()
{
rand = Math.floor(Math.random()*arr.length);
document.getElementById("url").href = arr[rand][1];
document.getElementById("url").innerHTML = arr[rand][0];
counter++;
if (counter == arr.length)
counter = 0;
}
setInterval('changelink()', 1000);