 |
 |
onClick window.open question
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2001
Location: England
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Ahaa!
My understanding of JavaScript has now doubled!
Thanks again...
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|