I have some javascript on my page that looks like this:
window.onunload=warn_form_data_loss();
form_dirty = true;
function warn_form_data_loss ()
{
if ( form_dirty = true)
{
var answer = (confirm("WARNING: You are about to navigate away from the current page, which may result in data loss. Would you like to proceed?"));
if (answer)
{alert("ok");}
else
window.stop;
}
}
For some reason, the onUnload() handler gets triggered when the page is loaded...anyone have any ideas as to why this is happening?
window.onunload=warn_form_data_loss();
form_dirty = true;
function warn_form_data_loss ()
{
if ( form_dirty = true)
{
var answer = (confirm("WARNING: You are about to navigate away from the current page, which may result in data loss. Would you like to proceed?"));
if (answer)
{alert("ok");}
else
window.stop;
}
}
For some reason, the onUnload() handler gets triggered when the page is loaded...anyone have any ideas as to why this is happening?