SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Pacific Northwest
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Controlling content of parent window from child window

    Ok .. i'm feeling kinda dumb here.

    I've opened a remote (child) window from parent window (named "myWindow").
    The objective is to enable updates of parent window content from choices displayed in the child window.

    This works fine if i use HTML hyperlinks in the child window (with BASE target="myWindow") in heading.

    I would, however, like to have choices (links) displayed in a FORM (drop down list) and use a "onChange=" to update the parent window.

    I've tried the following:

    <SELECT size=3 name="URL"
    onChange="if(options[selectedIndex].value)
    myWindow.location.href=
    (options[selectedIndex].value)">


    Would appreciate any help from you more knowledgable folks.


    Regards

    michael
    www.thewebmechanic.com/

  2. #2
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    window.opener

    So, for a form it'd be:

    window.opener.formname

    for a new url (redirect) it'd be:

    window.opener.location.href="blah.html";

    etc, etc, etc.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  3. #3
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Pacific Northwest
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Almost but not there yet

    Jeremy ....

    Thankyou for your assistance.
    Unfortunately i'm still not quite where i need to be.

    I used your suggested window.opener.location.href="blah.html"; code in my child window and, much to my dismay, it updated a FRAME within the parent window. What i'm desiring to do is have the entire contents (all frames of the parent window updated.

    The entire parent window is defined by a FRAME named "myWindow". Is there a way to direct the selected URL to that specific FRAME using the "onChange" event ?

    Thankyou for your input.

    michael
    www.thewebmechanic.com/

  4. #4
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yeah, no problem...

    window.opener gets you to the same place in the parent window as "window." would get you normally (or parent. for that matter).

    So:

    <select name="jump" onChange="window.opener.main.location.href='this.form.jump.options[this.form.jump.selectedIndex].value';">

    The only thing you should need to change would be the name of the select (in the select and in the JS call) and the name of the target frame.

    Hope that helps.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright


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
  •