Posts: 2,320
Name: Keith Marshall
Location: West Hartford, CT
|
Using CouponGuy's idea, I played around and came up with a following solution. The script has to reside inside the html header for it to work properly.
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Random JS Page Jump</title>
<script type="text/javascript" language="javascript">
<!--// Random JS Page Jump Code
var jumpTo = new Array();
// Define possible url jumps
jumpTo[0] = 'http://www.webmaster-talk.com';
jumpTo[1] = 'http://www.google.com';
jumpTo[2] = 'http://www.apple.com';
jumpTo[3] = 'http://www.microsoft.com';
// Define random function
function getRandom() {
return Math.floor(Math.random() * jumpTo.length);
}
// Output meta refresh tag
javascript: document.write('<META HTTP-EQUIV="Refresh" CONTENT="3;URL=' + jumpTo[getRandom()] + '">');
//-->
</script>
</head>
<body>
Random JS Page Jump
</body>
</html>
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|