You Are Here: Home »   Code Wednesday January 7th 2009

Code Library - js

Random Page - (929 views)


<!-- NOTE: Place this code in between the head tags -->

<SCRIPT LANGUAGE="JavaScript">

<!-- Author: Skynet -->
<!-- Contact: skynetgroup@hotmail.com -->

<!-- Begin
var howMany = 2;  // max number of items listed below
var page = new Array(howMany+1);

page[0]="first-random-page.html";
page[1]="second-random-page.html";
page[2]="third-random-page.html";

function rndnumber(){
var randscript = -1;
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1));
}
return randscript;
}
quo = rndnumber();
quox = page[quo];
window.location=(quox);
// End -->
</SCRIPT>