SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    May 2000
    Location
    Casablanca, Morocco
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi
    Ok, here it is:
    I have an already opened window. From a second one, i want to open a document in that old opened window. it's something like this : window.open("document_url","old_opened_window_name").
    But what's that window name? where can i get it? is it the document name(*.htm)?
    I'd really appriciate any help.
    thanks a lot

  2. #2
    SitePoint Member
    Join Date
    Jun 2000
    Location
    Brossard
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by Redox:
    Hi
    Ok, here it is:
    I have an already opened window. From a second one, i want to open a document in that old opened window. it's something like this : window.open("document_url","old_opened_window_name").
    But what's that window name? where can i get it? is it the document name(*.htm)?
    I'd really appriciate any help.
    thanks a lot
    <HR></BLOCKQUOTE>


    When you open a window, the complete syntax is :

    windowReference = window.open(...);

    You can then address the window reference.

    Read the tutorials I wrote about Window manipulation using JavaScript:
    http://www.visicommedia.com/community/




    ------------------
    Dominic Tremblay
    AceHTML 4 Freeware
    http://www.visicommedia.com

  3. #3
    SitePoint Member
    Join Date
    May 2000
    Location
    Casablanca, Morocco
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dominic, your tutorial was helpful.
    I still have another question : the window i want to open the document in, is already created, but not using javascript, so it has no name. So can i assign a name to an already created window?

  4. #4
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you use HTML to open the first window, you'll have include [name=""] in the [a href=""] tag.

    ------------------
    Webmaster
    www.emudreams.web.com

  5. #5
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The following is compliments of devguru.com and it proves that both of the statements given to you above will not work as written and that your window should already be named.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>
    window.open(URL, name [, features])

    This method is used to open a new browser window. Note that, when using this method with event handlers, you must use the syntax window.open() as opposed to just open(). Calling just open() will, because of the scoping of static objects in JavaScript, create a new document (equivalent to document.open()), not a window.

    The available parameters are as follows:

    URL - this is a string containing the URL of the document to open in the new window. If no URL is specified, an empty window will be created.

    name - this is a string containing the name of the new window. This can be used as the 'target' attribute of a &lt;FORM&gt; or &lt;A&gt; tag to point to the new window.

    features - this is an optional string that contains details of which of the standard window features are to be used with the new window. This takes the form of a comma-delimited list. Most of these features require yes or no (1 or 0 is also o.k.) and any of these can be turned on by simply listing the feature (they default to yes). Also, if you don't supply any of the feature arguments, all features with a choice of yes or no are enabled; if you do specify any feature parameters, titlebar and hotkeys still default to yes but all others are no. Details of the available features are given below.

    Feature Description

    --------------------------------------------------------------------------------
    alwaysLowered When set to yes, this creates a window that always floats below other windows.
    alwaysRaised When set to yes, this creates a window that always floats above other windows.
    dependent When set to yes, the new window is created as a child (closes when the parent window closes and does not appear on the task bar on Windows platforms) of the current window.
    directories When set to yes, the new browser window has the standard directory buttons.
    height This sets the height of the new window in pixels.
    hotkeys When set to no, this disables the use of hotkeys (except security and quit hotkeys) in a window without a menubar.
    innerHeight This sets the inner height of the window in pixels.
    innerWidth This sets the inner width of the window in pixels.
    location When set to yes, this creates the standard Location entry feild in the new browser window.
    menubar When set to yes, this creates a new browser window with the standard menu bar (File, Edit, View, etc.).
    outerHeight This sets the outer height of the new window in pixels.
    resizable When set to yes this allows the resizing of the new window by the user.
    screenX This allows a new window to be created at a specified number of pixels from the left side of the screen.
    screenY This allows a new window to be created at a specified number of pixels from the top of the screen.
    scrollbars When set to yes the new window is created with the standard horizontal and vertical scrollbars, where needed
    status When set to yes, the new window will have the standard browser status bar at the bottom.
    titlebar When set to yes the new browser window will have the standard title bar.
    toolbar When set to yes the new window will have the standard browser tool bar (Back, Forward, etc.).
    width This sets the width of the new window in pixels.
    z-lock When set to yes this prevents the new window from rising above other windows when it is made active (given focus).


    These features may only be used with IE4:

    channelmode sets if the window appears in channel mode.
    fullscreen the new window will appear in full screen.
    left same as screenX, allows a new window to be created at a specified number of pixels from the left side of the screen.
    top same as screenY, allows a new window to be created at a specified number of pixels from the top of the screen.

    The following example creates a new window of the specified dimensions complete with toolbar, changes the background color and writes a message to it.

    Code:
    myWindow = window.open("", "tinyWindow", 'toolbar,width=150,height=100')
    myWindow.document.write("Welcome to this new window!")
    myWindow.document.bgColor="lightblue"
    myWindow.document.close()
    <HR></BLOCKQUOTE>

    Now if you look... the second parameter you send to the window.Open method is in fact the name that you will be assigning to the new window. Name is a required parameter (notice the lack of brackets around it), so the method should fail if you don't supply a name, just make sure its a valid name and you remember it.


    Now to have another document be opened in that window you would use the Name attribute of the A tag as suggested by Elledan above.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Studios - Making Magic with Web Applications
    wluke@digitalmagician.com

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Wayne, that does not apply if the window was opened with &lt;A HREF=... TARGET="_blank"&gt;.

    Redox, if this is indeed how you're opening the window, assign it a name instead: &lt;A HREF=... TARGET="windowName"&gt;.




    ------------------
    -Kevin Yank.
    http://www.SitePoint.com/
    Helping Small Business Grow Online!

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I gathered he was opening the window from Javascript in the first place in which case it shouldn't be "_blank". Though it could have been. Good point.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Studios - Making Magic with Web Applications
    wluke@digitalmagician.com


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
  •