JavaScript错误处理

xiaoxiao2022-12-05  106

<html> <head> <title>错误处理</title> <script language="javascript" type="text/javascript"> <!-- window.onerror = showErr; function showErr(errMessage,errUrl,errLine) { var str = "JavaScript程序出错:\n" str += "错误信息:" + errMessage + "\n"; str += "产生错误的文件:" + errUrl + "\n"; str += "产生错误的行数:" + errLine + "\n"; alert(str); return true; } //以下是一个错误语句,因为变量a和b都没有定义。 var err = a*b; --> </script> </head> <body> </body></html>
转载请注明原文地址: https://www.6miu.com/read-4979304.html

最新回复(0)