...

View Full Version : Need a script for a random page after a random time



Justin Smith
01-09-2004, 03:01 AM
Can anyone help ? - Anyone used one / seen one ?

I need a page to load and then, after a random period of time between two variables, it loads a page, and I want that page to be random.

I have found two script that do each of the above but I do not have the skill required to combine them to do what I need ?

Can you help....

Thanks,

Justin Smith

kwhubby
01-09-2004, 05:10 AM
you could do something like this


var urls = new Array()
urls[0] = "http://google.com"
urls[1] = "http://yahoo.com"
urls[2] = "http://amazon.com"
urls[3] = "http://codingforums.com"

function startr() {
var mintime = 1000
var maxtime = 5000
setTimeout("randomloc()" ((Math.random()*(maxtime-mintime))+mintime))
}
function randomloc() {
location.href = urls[Math.random()*urls.length]
}

and then have in the body tag a onload="startr()"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum