haymansfield DeleteThis @googlemail.com wrote:
> Hi,
> Im trying to capture the value the user inputs into the dialog box
> brought up when the onBeforeUnload event is given an
> event.ReturnValue.
> If the user selects ok i dont need to do anything but if he selects
> cancel (stay on the same page) I want to change the value of a
> variable. Is this possible,
> Any advice would be helpful,
> Cheers,
> haymansfield
This might be useful to you, I use an approach from this page:
http://forums.devarticles.com/javascript-development-22/how-to-stop-br...er-from
function exitcheck(){
if (quit()) {
// user clicked OK
// do what you want here...
}else{
//user clicked CANCEL
// do what you want here...
}
}
function quit() {
if (confirm('Quit ?')){
return true;
}else{
return false;
}
}
window.onbeforeunload = exitcheck;