Thursday, February 5, 2009

Javascript Error trapping


onerror=handleErr;
var noErrors = true;

function handleErr(msg,url,l)
{
if(noErrors){
txt="There was an error detected.\n\n";
txt+="Error: " + msg + "\n";
txt+="URL: " + url + "\n";
txt+="Line: " + l + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
noErrors = false;
return true;
}
else{
return true;
}
}