Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Random url in new window help!!
Old 11-12-2007, 06:49 PM Random url in new window help!!
travelnet's Avatar
Novice Talker

Posts: 9
Name: john
Trades: 0
I need js to produce a link to random page on website that can also display in new window. and if possible control is size and shape to hold just the image.

currently effectively using (but is not new window):

i<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function go_to(url) {
window.location=url;
}
function rand_link() {
var a;
a = 1+Math.round(Math.random()*22); // a = random number between 1-22

if (a==1) go_to("image URL");
if (a==2) go_to("image URL");
if (a==3) go_to("image URL");
if (a==4) go_to("image URL");
if (a==5) go_to("image URL");
if (a==6) go_to("image URL");
and so on up to 22
}

// End -->
</SCRIPT>

<BODY>
<CENTER>
<FORM NAME="myForm">
<INPUT TYPE="button" NAME="myButton" VALUE="Pick a Card"
onClick="rand_link()">
</FORM>
</CENTER>


works great but how can i make any of the random links open in new window?

thanks.
travelnet is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-22-2007, 04:53 AM Re: Random url in new window help!!
Novice Talker

Posts: 5
Name: Lai Ying
Trades: 0
you should not use window.location=url; but code as window.open(url)
Vivi is offline
Reply With Quote
View Public Profile
 
Old 12-01-2007, 09:48 PM Re: Random url in new window help!!
travelnet's Avatar
Novice Talker

Posts: 9
Name: john
Trades: 0
thank you so much
travelnet is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Random url in new window help!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27649 seconds with 12 queries