View Full Version : Random Meta Refresh
is it possible to place a random refresh that sends people to one of the pages listid in the code?
Ive looked everywhere for such a script, but noone has it, but seems pretty useful, makes me think it cant be done, can it??
premshree
07-15-2002, 07:22 AM
I don't know whether it can be done using <meta> refresh.....but it can be easily done using JavaScript :
<script language="JavaScript">
function refresh_url()
{
var urlArr = new Array ("http://www.1.com", "http://www.2.com"); // Add elements here
location.href=urlArr[Math.round((urlArr.length-1)*Math.random())];
}
refresh_url();
</script>
:thumbsup:
Thanks Premshree!
But can you assign a delay to the links? If not, doesnt matter, ive got the code in use already.. thanks.
premshree
07-15-2002, 12:02 PM
Yes you can set a delay. Try this :
<script language="JavaScript">
function refresh_url()
{
var urlArr = new Array ("http://www.1.com", "http://www.2.com"); // Add elements here
location.href=urlArr[Math.round((urlArr.length-1)*Math.random())];
}
setTimeout("refresh_url()",1000);
</script>
Here 1000 is the delay in milliseconds.
:thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.