Semplice.
genera un numero random
Codice PHP:
var i = Math.round(5*Math.random());
così lo genera da 1 a 100
Codice PHP:
var i = Math.round(5*Math.random());
così da uno a 5.
Ad esempio tu hai 5 pagine
Codice PHP:
var pagine = {1 : "index1.htm", 2 : "index2.htm", 3 : "index3.htm", 4 : "index4.htm", 5 : "index5.htm"};
basta eseguire
Codice PHP:
window.location=pagine[i];
fatto. Quindi, ricapitolando ecco il codice finale
Codice PHP:
<script type="text/javascript">
var i = Math.round(5*Math.random());
var pagine = {1 : "index1.htm", 2 : "index2.htm", 3 : "index3.htm", 4 : "index4.htm", 5 : "index5.htm"};
window.location=pagine[i];
</script>
Spero possa tornarti utile!