homepage Welcome to WebmasterWorld Guest from 54.167.185.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Open new window from pop-up
woldie




msg:1485936
 12:13 pm on Jan 28, 2005 (gmt 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.

 

Bernard Marx




msg:1485937
 2:17 pm on Jan 28, 2005 (gmt 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.

woldie




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

Thanks Bernard.

That did work.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved