Debugging JavaScript errors is a time-consuming effort requiring keen eyes and a sharp mind.
MSIE typically only gives a cryptic ‘Object Expected’ error message and little more (even with the Microsoft Script Debugger installed!).
Some tools like FireBug and the Venkman debugger (both for Mozilla/Firefox) help in this matter, but often it helps to have an alert when an issue occurs.
Here’s a simple implementation that I’ve found useful…
[script type=”text/javascript”]
window.onerror=myErrorHandler;function myErrorHandler(msg,url,l){
var txt=”There was an error on this page.\n”;
txt+=”Error: ” + msg + “\n”;
txt+=”URL: ” + url + “\n”;
txt+=”Line: ” + l + “\n\n”;
txt+=”Click OK to continue.\n\n”;
alert(txt); return true; }
[/script]
REFERENCES:
That’s it….