To have a random site title for you site you would place the following code between your HEAD tags.
<script type="text/javascript" language="javascript"> </script>
Now to explain. This script checks the browser type that the viewer is using and if it's a Netscape 4 or higher, it uses an IF statement to run the code.
if (parseInt(navigator.appVersion) >= 4) {
Then the code deploys 2 variables. The first is "num" which is the Number of titles and MUST match the number of random titles being used. The second is "rantitle" which is an array that will form the random titles.
var num = 3; var rantitle = new Array(num+1);
Next are the random titles labeled by a number (must never repeat).
rantitle[1] = "This is random"; rantitle[2] = "Very Random"; rantitle[3] = "Yay it works";
The code then draws a random number.
ranNumber = parseInt(num * Math.random() + 1);
After that the code finalizes by altering the title of the page with the title that matched the random number.
document.title = rantitle[ranNumber];
Documentaion to Fire G. All rights © reserved. This may not be duplicated or reproduced without the consent of the owner.


Share the Love






Yeti
September 3rd
Great Tip! I think i may use it, its a cool feature! Thanks a lot!