Hey;
I'm completely new to javascript and am slowly working my way through
the O'Reilly's Javascript, the Definitive Guide. One of the examples
is supposed to pop up an alert box if there's a javascript error. I
typed in the code pretty much as documented but it didn't work. In
an attempt to troubleshoot, I simplified the thing but it's still
not working. The html and javascript code is posted below. Can
someone tell me what I screwed up?
I've hit the page with Opera 7.54, IE 6 and Netscape 7.0. Same results
in all three. I get the message between the <h1> tags but not the
alert window. All popup blockers have been turned off as well.
Thanks for any help.
Doug O'Leary
<html>
<body>
<script>
var error_count = 0;
var email = "dkoleary";
// Create the error handler function
function report_error(msg, url, line)
{ alert("You attempted bad!");
return true;
}
self.onerror = report_error;
</script>
<h1>Display something!</h1>
<hr>
<script>
alert(no_such_variable);
</script>
</body></html>