includes/clientside/static/misc.js
changeset 266 5d62ef764b0d
parent 259 112debff64bd
child 267 105457df35e5
equal deleted inserted replaced
265:915d399dfdbf 266:5d62ef764b0d
   123 function disableUnload(message)
   123 function disableUnload(message)
   124 {
   124 {
   125   if(typeof message != 'string') message = 'You may want to save your changes first.';
   125   if(typeof message != 'string') message = 'You may want to save your changes first.';
   126   var body = document.getElementsByTagName('body');
   126   var body = document.getElementsByTagName('body');
   127   body = body[0];
   127   body = body[0];
   128   body.onbeforeunload='return unescape(\''+escape(message)+'\')';
   128   body._unloadmsg = message;
       
   129   body.onbeforeunload = function() { return this._unloadmsg };
   129 }
   130 }
   130 
   131 
   131 function enableUnload()
   132 function enableUnload()
   132 {
   133 {
   133   var body = document.getElementsByTagName('body');
   134   var body = document.getElementsByTagName('body');
   134   body = body[0];
   135   body = body[0];
   135   body.onbeforeunload = null;
   136   body.onbeforeunload = null;
       
   137   body._unloadmsg = null;
   136 }
   138 }
   137 
   139 
   138 /**
   140 /**
   139  * Gets the highest z-index of all divs in the document
   141  * Gets the highest z-index of all divs in the document
   140  * @return integer
   142  * @return integer