say i have error like this : document.myTextBox.value object not found or dont xist how can i catch this error and tell the user what was the problem? thnaks in advance peleg
@JonaJun 01.2004 — #[i]Originally posted by pelegk1 [/i]
[B]
document.myTextBox.value object not found or dont xist
[/B][/QUOTE]
<i> </i><script type="text/javascript"> /* Goes in head tag */
window.onerror = myOnError; msgArray = new Array(); urlArray = new Array(); lnoArray = new Array(); function myOnError(msg, url, lno) { msgArray[msgArray.length] = msg; urlArray[urlArray.length] = url; lnoArray[lnoArray.length] = lno; return true; } function displayErrors() { win2=window.open('','window2','scrollbars=yes'); win2.document.writeln('<B>Error Report</B><P>'); for (var i=0; i < msgArray.length; i++) { win2.document.writeln('<B>Error in file:</B>'+urlArray[i]+'<BR>'); win2.document.writeln('<B>Line number:</B>'+lnoArray[i]+'<BR>'); win2.document.writeln('<B>Message:</B>'+msgArray[i]+'<P>'); } win2.document.close() } </SCRIPT>
[font=arial]After installing the above code in your head tag, create two buttons. One that generates an error, and one that calls the displayErrors() function (onclick="displayErrors()"). Click the button that generates an error, then click the button that displays the errors.
Notice: This script was created by Netscape. I found it a very long time ago, and don't remember where on Netscape's Web site I found it.[/font]