Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    Setting in a tall corn field in Indiana
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "window.open()" help

    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');"

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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');"

  • #3
    piz
    piz is offline
    Regular Coder
    Join Date
    Jul 2002
    Location
    Barcelona
    Posts
    246
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    New Coder
    Join Date
    Oct 2002
    Location
    Setting in a tall corn field in Indiana
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help, it works the way I want when I add it to the "onClick"

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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">

  • #6
    Regular Coder
    Join Date
    Dec 2002
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: "window.open()" help

    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 ****************

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •