<html> <head> <script type="text/javascript"> // 页面监听js报错问题 onerror=handleErr var txt="" function handleErr(msg,url,l) { txt="本页中存在错误如下:\n\n" txt+="错误:" + msg + "\n" txt+="URL: " + url + "\n" txt+="行:" + l + "\n\n" alert(txt) console.log(txt) return true } function message() { addalert("Welcome guest!") lert("Welcome guest!") } message() </script> </head> <body> <input type="button" value="查看消息" /> </body> </html>
原文地址:https://www.cnblogs.com/xiaohuizhang/p/11375920.html
时间: 2024-11-07 20:01:57