Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firing window unload event for multiple pages

Status
Not open for further replies.

sqlnerd

Programmer
Jan 21, 2003
24
IN
Hi,

I have to fire the unload event of a window, where i initially navigate thro few html pages without frames and then many pages inside a frameset. Now, i want to fire the unload event of this window across all the pages in this window without the need to put the code in all the initial pages and the frameset. I have to fire the event in only one place. How to do this? Typically, we fire the event in either body tag or frameset tag. Is there any other common place, where i can fire this? pls. help me out.
 
<script type=&quot;text/javascript&quot;>
function foo(s) {
alert(s);
}

window.onunload = function () { foo(&quot;Unload fired&quot;); };
</script>

=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
you might want to attach that to the main window:

<script type=&quot;text/javascript&quot;>
function foo(s) {
alert(s);
}

parent.window.onunload = function () { foo(&quot;Unload fired&quot;); };
</script>




=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top