14 Oct, 10:40PM in sunny Singapore!

urgent help

Subscribe to urgent help 0 posts

Please Login or Signup to reply.
  • Takumi2eLimit's Avatar
    5,551 posts since Dec '04
    • <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>P161</title>




      <script type = "text/javascript">

      var exitFlag = 0;
      function annoyUser(){
      if (exitFlag == 0) {

      window.onbeforeunload = function (e) {
      if (typeof(e) == 'undefined') e = window.event;

      document.getElementById('someContainer').style.display = 'block';

      e.returnValue = "Please don\'t go... =(";
      }
      }
      }

      function blockPopUp () {
      exitFlag = 1;
      alert ("You are moving to another page without having to see the annoying pop-up!");
      }

      </script>


      </head>

      <BODY onUnload="annoyUser()">

      <div id="someContainer" style="display: none; width: 500px; height: 320px; border: 1px solid #999;">
      <h1>Some box asking you to return here</h1>
      <p>lala, lala~ lala, lala~</p>
      </div>

      </body>
      </html>
      *********************************************************

      OnUnload i called the function, but why is it the function is not working? enlighten me please.

Please Login or Signup to reply.