<html> <head> <script type="text/javascript"> // 页面监听js报错问题 οnerrοr=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>