Aperture
Nov 7, 2006, 04:34 PM
Hi, I implemented a JavaScript code onto a .php file and made it my index on KevinSchaefer.net (http://kevinschaefer.net). The code is setup to redirect to a set of 3 URLs randomly, although it seems to favor one. I did 10 reloads, (Yes, going back to the index.php file ;) ) and 6/10 times it directed to this. (http://kevinschaefer.net/home/3/index.html). Sometimes it favors this. (http://kevinschaefer.net/home/2/index.html) Sorry if this sounds insane, its kind of annoying. Is there a way to make it purely random? Here is the code im using:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var pageArr = ["/home/1/index.html", "/home/2/index.html", "/home/3/index.html"];
document.location.href = pageArr[Math.ceil(Math.random()*pageArr.length)-1];
</script>
Any help appreciated.
Thanks, Kevin
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
var pageArr = ["/home/1/index.html", "/home/2/index.html", "/home/3/index.html"];
document.location.href = pageArr[Math.ceil(Math.random()*pageArr.length)-1];
</script>
Any help appreciated.
Thanks, Kevin
