Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > onClick window.open question

onClick window.open question
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status: Offline
Reply With Quote
Apr 14, 2005, 05:53 AM
 
Hello Readers

I have two hyperlinks in some text, both of which when clicked on open a smaller window to view some pictures. The first link is set to open a window at width 849 and height 301. The second hyperlink window is set at width 400 height 350.

The problem here is I cannot get two separate windows to open - if the first window is not closed, the second link will open in the first window.

here is the page with the hyperlinks in it:

http://www.pleaf.com/e5info.html

If you got this far, and understood any of the above -

How can I get the links to open independant of each other?

     
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Apr 14, 2005, 06:42 AM
 
The second argument to window.open() is the name of the window. This is so you can reference it later on, or open all pages in it. That's what you've done here. Just leave it blank:
window.open('link.html','','stuff');
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status: Offline
Reply With Quote
Apr 14, 2005, 08:21 AM
 
Originally Posted by Black Book
The second argument to window.open() is the name of the window. This is so you can reference it later on, or open all pages in it. That's what you've done here. Just leave it blank:
window.open('link.html','','stuff');
Okay, I tried the following from my understanding of the above:

I edited my code from this:

a onClick="window.open('m1b.html','nameforpop','resi zable=no, scrollbars=no, width=849, height=301, top=100, left=100');return false;" href="m1b.html" target="_blank"

to this:

a onClick="window.open('nameforpop','resizable=no, scrollbars=no, width=849, height=301, top=100, left=100');return false;" href="m1b.html" target="_blank"

But now the windows no longer retain their attributes, (they get scroll bars etc.)

I'd like to keep the attributes, so maybe I missed the point...

Thanks
     
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Apr 14, 2005, 08:33 AM
 
Yeah, you missed it

You'll notice I made the second argument blank. So you're just removing the name of (reference to) the window. Like so:

onClick="window.open('m1b.html','','resizable=no, scrollbars=no, width=849, height=301, top=100, left=100');

You had completely removed the first. Arguments need to be in order to have any meaning, hence there was no attributes being set, because you were putting all the stuff where it was expecting the name. You'd also omitted the URL of the page.
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status: Offline
Reply With Quote
Apr 14, 2005, 09:35 AM
 
Ahaa!

My understanding of JavaScript has now doubled!

Thanks again...
     
   
Thread Tools
Forum Links
Forum 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 On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:25 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2