Thanks for you guys' reply, one of my many attemp to solve this problem is to define a new function for the event but it still doesn't work.
my goal: to define a custom dialog box (that is, no other message would appear on the dialog box except the message i pass to it)
Code:<script language="javascript"> window.onbeforeunload = onBeforeUnload_Handler; function onBeforeUnload_Handler(){ fConfirm('param1','param2','param3','param3'); } function fConfirm(p1,p2,p3,p4) { //do something with p1, p2, p3, p4.... //this shows the default dialog box //event.returnValue = 'Any changes will be lost if you proceed.'; //this shows the custom confirm box, but it doesn't stop the page from //refreshing even the user click the "Cancel" button if(!confirm("Any changes will be lost if you proceed.")){ return false; } return true; } } </script>




Reply With Quote