<html>
<head>
<script type="text/javascript">
onerror=handleErr
var txt=""function handleErr(msg,url,l)
{
txt="There was an error on this page.\n\n"
txt+="Error: " + msg + "\n"
txt+="URL: " + url + "\n"
txt+="Line: " + l + "\n\n"
txt+="Click OK to continue.\n\n"
alert(txt)
return true
}function message()
{
adddlert("Welcome guest!")
}
</script>
</head><body>
<input type="button" value="View message" onclick="message()" />
</body></html>
以上代码,当点击按钮调用函数无法弹出对话框时,为什么自动会走‘handleErr’这个函数,‘onerror=handleErr’这句话是做什么的?每当用‘onerror’这个时一定要写‘onerror=handleErr’这个吗?