You could make a .JS file with a array containing the names ie:
var names = new Array("Henry","Bill","Fred");
function rand(num) {
return Math.floor(Math.random() * num)+ 1; /*returns a random number between 1 and the number it is given*/
}
document.write("<p>"+names[rand(2)]+"</p>");
You could insert the script straight in the page or in a seperate .js file and it will randomly select a name each time the page loads.
This requires no server side scripting and is very simple.
I have made a page simply demonstrating how the script works: http://www.ejumblesale.net/randomnames.htm
reload the page to change the name
Last edited by ejumblesale : 10-09-2004 at 02:14 PM.
|