I am using the setTimeout function within a for loop, and for some reason it is not working. I am trying to have the script open a website, wait 5 seconds then close the website. After it closes, it should then open the next website. However, it just opens and closes them instantly, with the exception of the last website, which it closes in 5 seconds
Here is the code:
----------------------------
Beau71 - MCSA
----------------------------
Here is the code:
Code:
<script type="text/javascript">
function openSites() {
var openOneAtATime=new Array()
openOneAtATime[0]="[URL unfurl="true"]http://www.ebay.com"[/URL]
openOneAtATime[1]="[URL unfurl="true"]http://www.google.com"[/URL]
openOneAtATime[2]="[URL unfurl="true"]http://www.cnn.com"[/URL]
openOneAtATime[3]="[URL unfurl="true"]http://www.yahoo.com"[/URL]
openOneAtATime[4]="[URL unfurl="true"]http://www.amazon.com"[/URL]
var i=0;
for (i=0;i<openOneAtATime.length;i++) {
WindowObjectReference = window.open(openOneAtATime[i],"window1")
setTimeout("WindowObjectReference.close()",5000)
}
}
</script>
----------------------------
Beau71 - MCSA
----------------------------