<html> <head> <title>OnError Example</title> <script type="text/javascript"> alert("Syntax error."; window.onerror = function (sMessage, sUrl, sLine) { alert("An error occurred:\n" + sMessage + "\nURL: " + sUrl + "\nLine Number: " + sLine); return true; } </script> </head> <body onload="nonExistentFunction()"> </body> </html>