Forum Moderators: open

Message Too Old, No Replies

'Page Rotation' Script?

A different page from a designated folder

         

markd

4:20 pm on May 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello everyone

I am trying to create a series of 'home pages', which when someone enters my URL they will be served at random one of a selection of pages. They actual pages themselves will be 'static' HTML, with no dynamic content.

I am sure I saw a script, based on a sort of redirect, which when someone enters a given URL they are presented with one of a selection of pages contained in a target directory.

eg. someone enteres 'www.mysite.com' and they get a different page from a the range contained in 'www.mysite.com/target_directory', or course just located in the root folder.

Has anyone seen this on one of the Java resource sites (I now can't find it) on know an easy way to do this?

Thanks in advance.

Bernard Marx

5:45 pm on May 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<script>
var root = "http://www.****xxxxxxx.com/"
URLs = ["page1.htm","page2.htm"."page3.htm"]

window.location.href = root + URLs[ Math.floor( Math.random()*URLs.length ) ]
</script>

(not tested, but it should work)

This could also be done with a little ASP and includes, so not requiring a redirect.

markd

6:19 pm on May 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks very much Bernard - I'll give this a test.