Connecting Tech Pros Worldwide Forums | Help | Site Map

Howto: Alert user when leaving a frame

IVer Erling Årva
Guest
 
Posts: n/a
#1: Jul 20 '05
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!

IVer@tda.no



Richard Cornford
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Howto: Alert user when leaving a frame


"Kevin Thorpe" <kevin@pricetrak.com> wrote in message
news:3f040281$0$13007$afc38c87@news.easynet.co.uk. ..
<snip>[color=blue]
> menu page:
> <script language="javascript">
> function checkchanged() {
> if (top.contentframe.changed) {
> alert('Please save your changes first');
> return false;
> } else {
> return true;
> }
> }
> </script>[/color]

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.


Closed Thread