<!-- This example is from the book _JavaScript: The Definitive Guide_. --> <!-- Written by David Flanagan. Copyright (c) 1996 O'Reilly & Associates. --> <!-- This example is provided WITHOUT WARRANTY either expressed or implied.--> <!-- You may study, use, modify, and distribute it for any purpose. --> <script> // a variable we use to ensure that each error window we create is unique var error_count =index.html 0; // define the error handler. It generates an HTML form so // the user can report the error to the author. function report_error(msg, url, line) { var w = window.open("", // URL (none specified) "error"+error_count++, // name (force it to be unique) "resizable,status,width=625,height=400"); // features var d = w.document; // We use this variable to save typing! // output an HTML document, including a form into the new window d.write('<DIV align=center>'); d.write('<FONT SIZE=7 FACE="helvetica"><B>'); d.write('OOPS.... A JavaScript Error Has Occurred!'); d.write('</B></FONT><BR><HR SIZE=4 WIDTH="80%">'); d.write('<FORM ACTION="mailto:TakeThisOuTnobodyKILLspam at TakeThisOuTnowhere.com" METHOD=post'); d.write(' ENCTYPE="text/plain">'); d.write('<FONT SIZE=3>'); d.write('<I>Click the "Report Error" button to send a bug report.</I><BR>'); d.write('<INPUT TYPE="submit" VALUE="Report Error"> '); d.write('<INPUT TYPE="button" VALUE="Dismiss" onClick="self.close()">'); d.write('</DIV><DIV align=right>'); d.write('<BR>Your name <I>(optional)</I>: '); d.write('<INPUT SIZE=42 NAME="name" VALUE="index.html">'); d.write('<BR>Error Message: '); d.write('<INPUT SIZE=42 NAME="message" VALUE="' + msg + '">'); d.write('<BR>Document: <INPUT SIZE=42 NAME="url" VALUE="' + url + '">'); d.write('<BR>Line Number: <INPUT SIZE=42 NAME="line" VALUE="' + line +'">'); d.write('<BR>Browser Version: '); d.write('<INPUT SIZE=42 NAME="version" VALUE="'+navigator.userAgent + '">'); d.write('</DIV></FONT>'); d.write('</FORM>'); // Remember to close the document when we're done d.close(); // Return true from this error handler, so that JavaScript does not // display its own error dialog. return true; } // Before the event handler can take effect, we have to register it // for a particular window. self.onerror =index.html report_error; </script> <script> // The following line of code causes the error that creates the dialog // box shown in the accompanying figure. self =index.html null; </script>
file: /Techref/language/JAVA/SCRIPT/definitive/examples/12.2.txt, 2KB, , updated: 1997/4/4 10:59, local time: 2024/12/25 09:00,
3.143.237.203:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/language/JAVA/SCRIPT/definitive/examples/12.2.txt"> language JAVA SCRIPT definitive examples 12</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.