leontager
07-21-2003, 05:06 PM
I am trying to create a simple script which would rederect me to several different websites with a one second interval.
this is my code
<html>
<body>
<script language="JavaScript1.1">
{
var sites = new Array();
sites[0]="http://www.yahoo.com";
sites[1]="http://www.geocities.com";
sites[2]="http://www.google.com";
for(x=0;x<3; x++)
{
setTimeout("window.location.replace(sites[x])",1000)
}
}
</script>
</body>
</html>
This is my first time doing anything in javascript and I got this code from a few examples I found on the net. I can not understand what is wrong with it. Why doesn't it go to all three websites?
this is my code
<html>
<body>
<script language="JavaScript1.1">
{
var sites = new Array();
sites[0]="http://www.yahoo.com";
sites[1]="http://www.geocities.com";
sites[2]="http://www.google.com";
for(x=0;x<3; x++)
{
setTimeout("window.location.replace(sites[x])",1000)
}
}
</script>
</body>
</html>
This is my first time doing anything in javascript and I got this code from a few examples I found on the net. I can not understand what is wrong with it. Why doesn't it go to all three websites?