includes/clientside/static/misc.js
changeset 267 105457df35e5
parent 266 5d62ef764b0d
--- a/includes/clientside/static/misc.js	Thu Dec 27 11:35:00 2007 -0500
+++ b/includes/clientside/static/misc.js	Mon Dec 31 21:16:27 2007 -0500
@@ -123,18 +123,19 @@
 function disableUnload(message)
 {
   if(typeof message != 'string') message = 'You may want to save your changes first.';
-  var body = document.getElementsByTagName('body');
-  body = body[0];
-  body._unloadmsg = message;
-  body.onbeforeunload = function() { return this._unloadmsg };
+  window._unloadmsg = message;
+  window.onbeforeunload = function(e)
+  {
+    if ( !e )
+      e = window.event;
+    e.returnValue = window._unloadmsg;
+  }
 }
 
 function enableUnload()
 {
-  var body = document.getElementsByTagName('body');
-  body = body[0];
-  body.onbeforeunload = null;
-  body._unloadmsg = null;
+  window._unloadmsg = null;
+  window.onbeforeunload = null;
 }
 
 /**