<html> <head> <title>OnError Example</title> <script type="text/javascript"> window.onerror = function () { alert("An error occurred."); } </script> </head> <body onload="nonExistentFunction()"> </body> </html>