frames and onUnload event not executing

Discussion in 'Javascript' started by Derek, Feb 23, 2005.

  1. Derek

    Derek Guest

    Hi All,

    I have an index.html file which sets up a frameset. On one of these frames I
    need an event that will trigger whenever the page is refreshed or changed
    for a certain page. Example:

    <frameset ...
    ....
    <frame src='somePage.html' ... >
    ....
    </frameset>

    And for the <BODY> declaration of "certainPage.html" I've got:
    <BODY onUnload='javascript:myFunction();'>


    The problem is when I load "certainPage.html" on it's own the onUnload
    trigger will fire correctly whenever the page is refreshed or it's location
    changed. However when I open up the "index.html" page with the frameset the
    onUnload event for "certainPage.html" won't fire. The interesting thing is
    that all onLoad events will fire properly but onUnload doesn't.

    Can anyone explain this to me?


    I've also thought about having an onUnload event for the frame itself (which
    would detect if the location.href = "certainPage.html") but I can't get that
    event to fire either.


    What's the easiest way to fire off some javascript for a page within a frame
    whenever it's content is changed?


    Any help / pointers / references appreciated.

    Cheers,
    Derek
     
    Derek, Feb 23, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.