...

View Full Version : Opening random url in new window



goldsky
02-25-2003, 02:25 PM
I am using the following script
<script>
var randomurls=new Array()
randomurls[0]="http://xxx1.com"
randomurls[1]="http://xxx2.com"
randomurls[2]="http://xxx3.com"
randomurls[3]="http://xxx4.com"
randomurls[4]="http://xxx.com"

function randomurl(){
window.location=randomurls[Math.floor(Math.random()*randomurls.length)]
}
</script>
and when I click on the link below it takes me to one othe links above
<a href="javascript:randomurl()" >Link</a>
I want to be able to open this link in a new window but target=_blank does not work does anyone have any ideas
thanks

king443
02-25-2003, 02:30 PM
window.open(randomurls[Math.floor(Math.random()*randomurls.length)]);

goldsky
02-25-2003, 02:42 PM
Many thanks, I did try window.open but in the wrong place.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum