Welcome to WebmasterWorld Guest from 54.196.214.35

Forum Moderators: open

Message Too Old, No Replies

Open new window from pop-up

     
12:13 pm on Jan 28, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Feb 13, 2003
posts:220
votes: 0


Hi,

Got this small problem, I'm having some trouble with pop up windows.

What I have is a pop up window, and in that you have a link which points to another site, but I would like to open a new browser window.

Any ideas?

<a href="http://domain.com/" onclick="window.open("","scrollbars=yes,width=750,height=580");return true;">Go</a>

This won't work :o(
Thanks.

2:17 pm on Jan 28, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:2047
votes: 0


<a href="http://domain.com/" onclick="window.open('http://domain.com/','','scrollbars=yes,width=750,height=580');return false;">Go</a> 

1. You need to use single quotes inside attributes, else the quoting doesn't make sense.

2. The URL needs to be given as the first arg to

open()
.

3. Leave the URL in the href, it will be used as a normal link if JS is disabled.

4. return

false
, so the href isn't followed if JS is working normally.

5. The open method takes 3 arguments.

6. Read some documentation.

3:34 pm on Jan 28, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Feb 13, 2003
posts:220
votes: 0


Thanks Bernard.

That did work.

I'll go and read some JavaScript. :o)