...

View Full Version : "window.open()" help



caclark
06-04-2003, 03:11 PM
I am using the javascript "window.open" command in a link so I can have control over all aspects of the window, (i.e. size, toolbar, windowbar...). But when I click on the link the new window opens like I want, but the parent window is blanked out and only "[object Window]" is displayed. I would like to keep the parent window intact as well.

What is causing this to happen, and is there a way to correct this problem?

**************** Sample Code Used ****************

<a href="javascript:window.open('- ADD LINK HERE -','purgelockwin','width=500,height=175','toolbar=no','menubar=no');"

arnyinc
06-04-2003, 03:20 PM
I'm not sure if this is the source of your problem, but there shouldn't be multiple apostrophes when you're specifying attributes after the window name.

<a href="javascript:window.open('- ADD LINK HERE - ','purgelockwin','width=500,height=175,toolbar=no,menubar=no');"

piz
06-04-2003, 03:22 PM
You have to put the code which opens the window in a function and call the function by the <a href>.

Or, another possibility, put the code in the onclick-Attribute and not in the href.

(In the href you can put simply a #)

Saludo
piz

caclark
06-04-2003, 03:30 PM
Thanks for the help, it works the way I want when I add it to the "onClick"

ahosang
06-04-2003, 05:53 PM
add return false for completeness. That will stop any animated gifs or any external loading from being tampered with:
<a href="#" onclick="window.open('- ADD LINK HERE - ','purgelockwin','width=500,height=175','toolbar=n
o','menubar=no');return false">

ca_redwards
06-06-2003, 02:38 AM
Be careful when using javascript that returns a value (albeit a simple window object)! It is more advisable to end your javascript link with void(0) to return nothing.

:ca_redwards.


Originally posted by caclark
I am using the javascript "window.open" command in a link so I can have control over all aspects of the window, (i.e. size, toolbar, windowbar...). But when I click on the link the new window opens like I want, but the parent window is blanked out and only "[object Window]" is displayed. I would like to keep the parent window intact as well.

What is causing this to happen, and is there a way to correct this problem?

**************** Sample Code Used ****************


<a href="javascript:window.open('- ADD LINK HERE -','purgelockwin','width=500,height=175','toolbar=no','menubar=no');"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum