I need to build a program that opens a website, waits for about 5 sec, then closes the website and opens a different website, it needs to loop about 5 times. The websites' URL will change just like in my code. I just don't know how to work the whole timer codes. My code...
<script>
var x = Math.floor(Math.random() * 20) + 1;
var y = Math.floor(Math.random() * 28) + 1;
for (i = 0; i < 5; i++) {
var wnd = window.open("http://www.random.com/x=" + x + "y=" + y);
setTimeout(function() {
wnd.close();
}, 5000);
};
</script>