x
 
<!DOCTYPE html>
<html>
<head>
<script>
onerror = handleErr;
var txt = "";
function handleErr(msg, url, l) {
  txt = "此页面出错。\n\n";
  txt += "错误:" + msg + "\n";
  txt += "URL:" + url + "\n";
  txt += "Line:" + l + "\n\n";
  txt += "单击“确定”以继续。\n\n";
  alert(txt);
  return true;
}
function message() {
   adddlert("欢迎访客!");
}
</script>
</head>
<body>
<input type="button" value="查看消息" onclick="message()" />
</body>
</html>