Results 1 to 2 of 2

Thread: Setting parent attribute value from child window using javascript

  1. #1
    Join Date
    Apr 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Setting parent attribute value from child window using javascript

    Hi All,

    I have a complex requirement and unable to resolve it.

    I have a parent window, that has the functionality to added a student name. Number of students that can be added is dynamic, that means there could be 1 or more input fields. For every field when the user enters 3 characters a child window pops up with a list of names and a radio button to select the name.

    In the child window, when the user selects a radio button and submits/saves, I want to populate the parent window with the name selected in the child window and close the child window.

    The tricky part is how to identify the parent input variable that called the child window.

    Any help is appreciated.

    Thank You.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,481
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    If it's a true child window opened by the parent, then from within the child window, the parent window is:

    Code:
    opener
    So you can do things like - say there's a var on the parent named bob. From the child, that's:

    Code:
    opener.bob
    Or, if you want to walk the document tree of the parent from the child:

    Code:
    opener.document.body
    will get you started.

    If you want more help, be much more specific and if possible post a link to the parent page and describe what actions, in detail, are to be done, and what the desired result is.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Close child window with parent window button
    By mohdanis2011 in forum JavaScript
    Replies: 1
    Last Post: 11-26-2010, 08:43 PM
  2. Child Iframe resizing another Child Iframe window in a parent.
    By Adonias_d in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 05-16-2007, 12:11 AM
  3. Parent-Child relation on Window
    By PradheepAyyanar in forum JavaScript
    Replies: 0
    Last Post: 07-07-2006, 04:47 AM
  4. Close Parent Window after child window opens
    By macknairb in forum JavaScript
    Replies: 1
    Last Post: 08-03-2005, 03:07 AM

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
  •