<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
window.onerror = function(errorMessage, scriptURI, lineNumber,columnNumber,errorObj) {
alert("错误信息:" + errorMessage);
alert("出错文件:" + scriptURI);
alert("出错行号:" +lineNumber);
alert("出错列号:" + columnNumber);
alert("错误详情:" + errorObj);
}
</script>
</head>
<body>
<script >
throw new Error("出错了!");
</script>
</body>
</html>