Click to See Complete Forum and Search --> : random selection


Bob Spaulding
08-17-2003, 06:16 PM
I need help with code that will randomly open 1 of 3 pages when a menu selection is made. Can you help me?

pyro
08-17-2003, 06:34 PM
You could try something like this:

<script type="text/javascript">
array = new Array("http://www.infinitypages.com","http://www.webdevfaqs.com","http://www.w3c.org")
function chooseUrl() {
num = Math.round(Math.random()*2);
window.location.href = array[num];
}
</script>