syd%netscape.com 3cb392cade In the spirit of DumpDOM, adding this to your JS file should cause a dialog to come up displaying the
first Javascript error encountered. Code taken from Danny Goodman's JavaScript Bible. Works with 4.x,
doesn't seem to work yet with 5.0 but I'll be filing a bug on that.


git-svn-id: svn://10.0.0.236/trunk@41278 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-27 09:01:51 +00:00

20 lines
721 B
JavaScript

function onerror(msg, URL, lineNum) {
var errWind = window.open("","errors","HEIGHT=270,WIDTH=400");
var wintxt = "<HTML><BODY BGCOLOR=RED>";
wintxt += "<B>An error has occurred on this page.</B>";
wintxt += "<FORM METHOD=POST ENCTYPE='text-plain'>";
wintxt += "<TEXTAREA COLS=45 ROWS=8 WRAP=VIRTUAL>";
wintxt += "Error: " + msg + "\n";
wintxt += "URL: " + URL + "\n";
wintxt += "Line: " + lineNum + "\n";
wintxt += "Client: " + navigator.userAgent + "\n";
wintxt += "-----------------------------------------\n";
wintxt += "</TEXTAREA><P>";
wintxt += "<INPUT TYPE=button VALUE='Close' onClick='self.close()'>";
wintxt += "</FORM></BODY></HTML>";
errWind.document.write(wintxt);
errWind.document.close();
return true;
}