PDA

View Full Version : random url in frame?



robe
Mar 15th, 2007, 12:34 PM
Hi!

In an old thread goldsky had written this script
it's a random link script, it open a new window with a random webpage.
How do I make it open in another frame in my frameset?

<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.open(randomurls[Math.floor(Math.random()*randomurls.length)]);
}
</script>


<a href="javascript:randomurl()" >Link</a>


Thanks!

robe.

BarrMan
Mar 15th, 2007, 01:50 PM
ur_frameset_name.location.href=ur_new_link;
And you could have at least changed your links.

robe
Mar 15th, 2007, 04:02 PM
Thanks for the help. But, please excuse my newbieness, where do I put that code?

ehh... change my links, what do you mean? The xxx.com links or...
The code is exactly as goldsky (in this forum) wrote it with links and all.

robe.

glenngv
Mar 15th, 2007, 09:15 PM
function randomurl(){
window.open(randomurls[Math.floor(Math.random()*randomurls.length)], "frameName");
}

robe
Mar 19th, 2007, 06:12 PM
Thanks for your help.

Great with such a helpful forum!!!


:) :thumbsup: