Welcome visitor
* Login
* Register
It is currently July 20th, 2019, 11:35 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  random location.href
PostPosted: August 4th, 2009, 2:11 am 

Posts: 17
Hey, im looking for a script to redirect the user to a random page but all the code i can find is about redirecting to an static fixed address.

Can you help me setting a random URL destination?
Thank you.


Top
 Profile  
 
  Re: random location.href
PostPosted: August 4th, 2009, 2:39 am 

Posts: 57
<script type="text/javascript">
      home = new Array("home1.htm", "home2.htm", "http://www.scriptingok.com")
      document.location.href = home[Math.ceil(Math.random()*home.length)-1];
</script>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron