function handleErrors(msg, url, line)
{
var errorString = "JavaScript Error Occured\n";
errorString += "Message: "+msg+"\n";
errorString += "Url: "+url+"\n";
errorString += "Line: "+line;
alert(errorString);
return true;
}

window.onerror = handleErrors;

 
If you want to suppress the error message just comment out the alert(errorString); line. the javascript errors will be suppressed and the user cannot see any js errors