How to deliver a random page from a single link?
June 27, 2007 10:35 AM Subscribe
If I have "page1.html", 'page2.html", "page3.html" and "page4.html" and on examplehomepage.com I have a link that says, "give me a random page" how do I make it so that link delivers 1,2,3 or 4 randomly each time the link is clicked?
I am building my first website, using Nvu. I think I get the basic concepts. I know this random page thing is probably way over my head as I am such a novice, but I really want to include it. I am hoping it is easy enough that askmefi can save me once again!
I am building my first website, using Nvu. I think I get the basic concepts. I know this random page thing is probably way over my head as I am such a novice, but I really want to include it. I am hoping it is easy enough that askmefi can save me once again!
<a href="#" onclick="setTimeout(function() { window.location.href = 'page' + Math.floor((Math.random() * 4 + 1)) + '.html' }, 1); return false">give me a random page</a>
posted by Khalad at 10:46 AM on June 27, 2007
This thread is closed to new comments.
posted by turaho at 10:46 AM on June 27, 2007