日期:2014-05-16 浏览次数:20436 次
1.JS中就只有1个catch
<script>
try
{
window.noFoundFunction();
}
catch(exception) //JS中就只有1个catch
{
alert("catch ");
}
finally
{
alert("finally");
}
</script>
?
2.SyntaxError只有当eval函数调用发生错误的时候才会被抛出
<script>
try
{
eval("a++b");
}
catch(exception)
{
//SyntaxError只有当eval函数调用发生错误的时候才会被抛出
if(exception instanceof SyntaxError)
{
alert("evel函数执行引起的错误: " + exception.message);
}
else
{
alert("其他错误 :" + exception.message);
}
}
</script>
?