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 11 of 11

Thread: Popup Window

  1. #1
    New Coder
    Join Date
    Nov 2002
    Location
    CT
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Popup Window

    How can I link an HTML webpage and have it open in a simple popup window?!?!?!

    MAtt -

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    <a href="javascript:onclick(window.open('yourpage.htm'))">link text</a>

    edit: take out the space in java script

    Go here for more options:

    http://developer.irt.org/script/90.htm
    Last edited by arnyinc; 01-21-2003 at 08:57 PM.

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My preferred method
    Code:
    <a href="somepage.htm" target="sometarget" onclick="window.open(this.href, this.target, features); return false;">link</a>
    Last edited by beetle; 01-21-2003 at 11:11 PM.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Go with beetle's suggestion. It looks like it is more backwards compliant.

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by arnyinc
    Go with beetle's suggestion. It looks like it is more backwards compliant.
    And search engine friendly, too
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #6
    New Coder
    Join Date
    Nov 2002
    Location
    CT
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup Window

    Beetle: I not clear on the end part of the popup window code you gave me:

    (this.href, this.target, features);">

    Is this.href and this.target the same source as "somepage.htm" and "sometarget"? And what is features. Can you throw together a quick example. Thanks in advance!

    Matt -

  • #7
    New Coder
    Join Date
    Nov 2002
    Location
    CT
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup Window

    I get what the features are: toolbar, size, etc, but I didn't get that to work. I did get the window to open in a popup though.

    Matt -

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    features is a comma separated string of window features. The most common features are (with their datatype)
    • width: integer
    • height: integer
    • top: integer
    • left: integer
    • location: boolean
    • menubar: boolean
    • scrollbars: boolean
    • status: boolean
    • toolbar: boolean
    The width, height, top and left all pertain to the popup's size and position. All the rest of these features are literally window features
    • location - the address bar
    • menubar - File Edit View etc...
    • scrollbars - duh
    • status - the statusbar at the bottom of the window
    • toolbar - The back, foward, home, etc buttons
    Now, by default, all the window features are off, or have a false value, so you only need to include those which you want to be true.

    window.open( this.href, this.target, 'width=300, height=200, top=100, left=100, status=1, scrollbars=1, toolbar=1');

    This opens a 300x200 window, positioned at 100,100 with the statubar, scrollbars, and the toolbar.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #9
    New Coder
    Join Date
    Nov 2002
    Location
    CT
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup Window

    Beetle:

    How do I list the target? I have it as target="_blank", but what about the this.target. What do I do with that?

    Here's my current code:

    <a href="case.html" target="_blank" onClick="window.open(case.html),'height=300, width=300, top=100, left=100, status=1, scrollbars=1, toolbars=1';">link</a>


    Matt -

  • #10
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <a href="case.html" target="_blank" onClick="window.open(this.href, this.target,'height=300, width=300, top=100, left=100, status=1, scrollbars=1, toolbars=1'); return false;">link</a>
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If concerned with older Netscape browsers, don't use spaces between the window parameters.


  •  

    Posting Permissions

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