Listing 1
try {
var x == 5;
//we are just "trying" this because we know it will break
} catch (myerrorname) {
//IE uses "description", but NN uses "message" instead
if (myerrorname.description == null) {
alert("Error:" + exception.message)
} else {
alert("Error:" + exception.description)
}
}


Listing 2
<script>
<!--
function errAlert(msg, errUrl, line) {
alert(msg);
alert(errUrl);
alert(line);
return true;
}
window.onerror = errAlert;
// -->
</script>
<html>
<head>
<title>JS Error Test</title>
<script>
function testJS() {
fred = barney;
}
</script>
</head>
<body>
<script>testJS()</script>
Loaded
</body>
</html>


Listing 3
<cfmail
to="sebtools@yahoo.com"
from="robot@tidf.com"
subject="JavaScript Error"
type="HTML">
There was a JavaScript error. <br>
<br>
CGI.SERVER_NAME = #CGI.SERVER_NAME#<br>
CGI.HTTP_USER_AGENT = #CGI.HTTP_USER_AGENT#<br>
<br>
<cfdump var="#Session#">
<br>
<cfdump var="#URL#">
</cfmail>