Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    New York

    refresh parent window on close

    Hello. I am using the greybox script found here

    However what I want to do is when the close image link is clicked I want the parent window to automatically refresh. I am hoping someone is familar with this script and can tell me what the code would be and where to put it within this script
    just a programmer

  2. #2
    Join Date
    Jan 2006
    Athens, Greece
    This is inline html, there is nothing to refresh. Which means if you refresh the greybox
    will disappear. What exactly do you want to do, update some html on the "parent" window
    or the whole page?

    You will have to search for the close function on the script and do the refresh (window.location.reload()).

  3. #3
    I was recently trying to do this same thing (also using GreyBox by OrangeGoo). I modified the gb_scripts.js file. Right at the top there's a function called GB_CURRENT.hide.

    I changed the GB_CURRENT.hide function to this:

    // enable us to have an "after close" event (but don't require it)...
    if(typeof GB_afterclose == 'function') {
    // use a setTimeout so that it's a completely separate instance...
    setTimeout("GB_afterclose();", 100);

    Then, I created a GB_afterclose() function on the target page. If you did the same you could put something like window.location.reload() in the GB_afterclose() function (as suggested by Steve).

    On a side note--the "if" statement basically makes it so that if the GB_afterclose function doesn't exist on a page then the user won't get an error.

    I hope this helps.

  4. #4
    I can't seem to get it to work:

    Im using ASP and its doing some inserting into a database which works fine which is the window opened by greybox then I want it to close the window and reload the parent page (it is a schedule so the pop up added the event so when the window closes I want it to refresh the schedule so it shows as added) so I used:

    <body onload="parent.parent.GB_hide()">

    I then added on the parent page the code as :

    <script type="text/javascript" src="../popups/AJS.js"></script>
    <script type="text/javascript" src="../popups/AJS_fx.js"></script>
    <script type="text/javascript" src="../popups/gb_scripts.js"></script>
    <script language="javascript" type="text/javascript">
    function afterclose() {
    // -->

  5. #5
    Hey Biggrecian,

    A few quick tips:

    1) There's no need to add a GB_hide() to the body's onload event. The GB_hide() function is called by GreyBox when it closes the child window.

    2) If you used the code that I mentioned in my last post then your function should be named GB_afterclose().

    3) If you didn't modify the GB_CURRENT.hide function (in gb_scripts.js) then that's all you need to do (but be sure to rename your afterclose function to GB_afterclose).

    If you can't get this working then one alternative would be to have your form add a window.location.reload() to the page after it successfully saves the data.

    I hope this helps. :-)

    SpamHero - Be spam free in 5 minutes
    Domain wide spam filtering, unlimited email addresses
    Join our affiliate program and offer professional spam filtering today!

  6. #6

    Thanks a lot

    After spending lot of time i get this solution...

    Really Thanks a Lot Dude!

Similar Threads

  1. Open these links in parent window?
    By jicola in forum Programming Discussion
    Replies: 1
    Last Post: 04-30-2008, 05:25 AM
  2. [Javascript] Refresh Parent & Control Child still ??
    By Oshaka in forum Programming Discussion
    Replies: 1
    Last Post: 09-14-2006, 07:04 AM
  3. Fit IFrame in the parent window?
    By null in forum Programming Discussion
    Replies: 1
    Last Post: 12-12-2005, 03:08 AM
  4. Problem refreshing parent window
    By Pere in forum Programming Discussion
    Replies: 1
    Last Post: 06-17-2003, 05:02 PM
  5. Javascript close window + refres(reload) window
    By Syncedit in forum Programming Discussion
    Replies: 2
    Last Post: 12-30-2002, 03:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts