View Full Version : Javascript to reload page on unLoad

08-01-2002, 07:18 AM
Hello all!

I want to use a JavaScript that allows me to make the user fill out a form. The form is loaded in a 3-frame frameset in the main window, and there are navigational links in the left frame that change what is displayed in the main frame.

I want to set up the form so that it will be reloaded if the user tries to escape by clicking on any of the nav links in the left frame.

I understand that it requires an onunLoad event handler in the <body> tag, but I cant get my head around the function that needs to be set up in order to execute this event.


mmasci :( :(

08-01-2002, 08:04 AM
you must set up your navigation page like this:

function openPage(url){
fillUpPage = "YourFillUpPageHere.htm";//this is the page where the user must fill-up the form
if (top.frames["YourMainFrameNameHere"].location.href.indexOf(fillUpPage)!=-1){

then in your links:

<a href="javascript:openPage('link1.htm')">Link1</a>
<a href="javascript:openPage('link2.htm')">Link1</a>