SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard jumpthru's Avatar
    Join Date
    Apr 2000
    Location
    Los Angeles, California
    Posts
    1,008
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    open.window question...

    Code:
    var help_window=window.open('', 'does_nothing', 'scrollbars=yes,resizable=yes,width=200,height=400'); help_window.document.write('stuff'); help_window.focus();\">Help</a>
    What is the point of the second argument in the window.open function ('does_nothign')? I think its called the 'window name' but you cant reference the window by it, you must reference it by the returned variable. What does this 'window name' even do?

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it refers to the relation it has with other windows. So if you wanted to later on close it, you would need to have specified its name/relationship.

    Might be wrong...
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Wizard jumpthru's Avatar
    Join Date
    Apr 2000
    Location
    Los Angeles, California
    Posts
    1,008
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you use the return variable to close it. I still haven't found a use for that name thing.

    Anyone know?

  4. #4
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe that it lets you assign a name to the window. I have used it in instances where I have multiple links that need to open in a new browser window. Because I don't want to clutter the user's computer with lots of "new" browser windows, I assign all of the windows the same 'name'. This way if they leave one of the browser windows open, then return to the main page and click another link which opens in a new browser window, it won't open a 'new' window, it will open in the existing window.

  5. #5
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    There's also an HTML name thing. Just like you can target frames, you can target new windows with HTML:

    <a href="somepage.html" target="theNameThing">

    Where the target="..." is where the name thing comes in handy. Now, in Window's mind, each window witht he same name (as used for the target="...") is it's own window, so subsequent calls to open a window with the same name just changes the URL of that window. While, the variable actually refers to that window object.

    aDog

  6. #6
    SitePoint Wizard jumpthru's Avatar
    Join Date
    Apr 2000
    Location
    Los Angeles, California
    Posts
    1,008
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Arielladog
    Hey,

    There's also an HTML name thing. Just like you can target frames, you can target new windows with HTML:

    <a href="somepage.html" target="theNameThing">

    Where the target="..." is where the name thing comes in handy. Now, in Window's mind, each window witht he same name (as used for the target="...") is it's own window, so subsequent calls to open a window with the same name just changes the URL of that window. While, the variable actually refers to that window object.

    aDog
    Okay yea, your exactly right. Thank you, and thank you makeda. I wasn't thinking in terms of HTML, I was just thinking in terms of javascript, and it seemed redundant, but now it makes perfect since. Thanks again.


Bookmarks

Posting Permissions

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