SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member wulf's Avatar
    Join Date
    Jul 2006
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    affect another window

    Hey I was wondering how I make the variable of a popupwindow affect the window that it popped up from in javascript...

  2. #2
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just set it to a variable and use it...
    for example...

    var childWin = window.open(theURL,winName,features);
    if(window.focus)
    {
    childWin.focus();
    }
    will open a child window and set the focus to it...it is a standard window object so you can drill down from there...hope that helps.

  3. #3
    Non-Member wulf's Avatar
    Join Date
    Jul 2006
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no thats not what I mean... I have a main window and from there I make a popup link... now in that popup window is a form. I want the contents entered into that form to be applied to the previous window that it popped up from...

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The window that opened the current one can be referenced as opener eg.

    opener.focus();

    will bring that window in front of the current one.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    &#083;itePoint Aficionado JVLB's Avatar
    Join Date
    Jan 2002
    Location
    N 44 56.537' W 123 3.683'
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The target attribute of an HTML form allows you to send the form contents to a named window. As the original browser window usually doesn't have a name, you'll have to assign it one with window.name. If you are giving the name to the parent window from the popup, you'll need to use opener.name, as 'opener' is the parent of a window (as opposed to frames, where it is ' parent').


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
  •