13.4 错误处理与error对象3.html
来自「javascript即用即差核心对象手册」· HTML 代码 · 共 41 行
HTML
41 行
<body>
<table id="info" cellpadding=1 cellspacing=1>
<tr><td colspan="2" align="center" bgcolor="#CCCCCC">有错误发生了</td></tr>
<tr>
<td bgcolor="#CCCCCC">错误编号</td>
<td></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">错误名称</td>
<td></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">错误说明</td>
<td></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">错误信息</td>
<td></td>
</tr>
</table>
<script>
try
{
var num=eval("av");
}
catch(err)
{
writeErrorInfo(err);
}
function writeErrorInfo(err)
{
with(document)
{
getElementById("info").rows(1).cells(1).innerText=err.number;
getElementById("info").rows(2).cells(1).innerText=err.name;
getElementById("info").rows(3).cells(1).innerText=err.description;
getElementById("info").rows(4).cells(1).innerText=err.message;
}
}
</script>
</body>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?