Howto: Alert user when leaving a frame

  • Thread starter IVer Erling Årva
  • Start date
I

IVer Erling Årva

I have a frameset where one frame contains a menu and the other the screens
where the contents change depending on what the user clicks in the menu.

Is there any relatively easy way to give the user a warning that changes
should be saved and will be lost unless doing so when she or he clicks an
option in the menu. This should of course only happen if something is
changed.

Any help is appreciated!

(e-mail address removed)
 
R

Richard Cornford

menu page:
<script language="javascript">
function checkchanged() {
if (top.contentframe.changed) {
alert('Please save your changes first');
return false;
} else {
return true;
}
}
</script>

This would prevent navigation following any changes but suppose the
changes were a mistake and should not be saved.

function checkchanged(){
if(top.contentframe.changed){
return confirm(
'You have unsaved changes that will be lost!\n'+
'Do you want to continue anyway?'
);
}
}

Richard.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top