topical media & game development

talk show tell print

basic-javascript-10-TryCatch.htm / htm



  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <body>
  <script language="JavaScript" type="text/javascript">
  try
  {
     alert('This is code inside the try clause');
     alert('No Errors so catch code will not execute');
  }
  catch(exception)
  {
     if (exception.description == null)
     {
        alert("Firefox says the error is " + exception.message)
     }
     else
     {
        alert("Internet Explorer says the error is " + exception.description);
     }
  }
  </script>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.