asp.net - How to determine which control in window.onbeforeunload in javascript caused the event -


i have set in javascript:

var    onbeforeunloadfired = false;  window.onbeforeunload = function (sender, args)  {    if(window.event){       if(!onbeforeunloadfired) {          onbeforeunloadfired = true;          window.event.returnvalue = 'you lose unsaved changes!'; //ie       }    }    else {       return 'you lose unsaved changes!'; //fx    }     windows.settimeout("resetonbeforeunloadfired()", 1000); }  function resetonbeforeunloadfired() {    //need variable prevent ie firing twice.    onbeforeunloadfired = false; } 

i'm trying achieve edit screen user warned before navigating away. works fine except pop normal post backs of button clicks. i'm hoping avoid i'm figuring if determine button pressed work.

does know how determine button pressed in windows.onbeforeunload?

alternatively know better approach i'm trying achieve?

solved putting update panel edit items textboxes etc.

now windows.onbeforeunload fires components external this.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -