refresh parent window from child window close button

Posted on 2007-10-11
Last Modified: 2012-06-27
i have a parent window that opens a child window.  the user enter data into the child windows form and submits the child.  the child window also contains a close button.  when clicked i want to refresh the parent window but it isnt working:

<input type="button" onclick="javascript:parent.opener.location.refresh();this.close();" name="closeBtn" value="Close" />

When i click close, the child window close, but my parent window does not refresh.
Question by:ellandrd
    LVL 9

    Accepted Solution

    Try window.opener instead of parent.opener

    <input type="button" onclick="javascript:window.opener.location.refresh();this.close();" name="closeBtn" value="Close" />
    LVL 9

    Expert Comment

    If that doesn't work, try reload() instead of refresh():

    <input type="button" onclick="javascript:window.opener.location.reload();this.close();" name="closeBtn" value="Close" />
    LVL 16

    Author Comment

    opener.parent.window.location.href worked.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved." Ralph Waldo Emerson Introduction: One of the wonderful things about the web is that it makes it s…
    Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now