<script language="JavaScript">
var x = 10;
try{
x = y;
var x = 10;
try{
x = y;
// 測試的錯誤程式碼
}
catch(e){
// 錯誤處理的程式碼
document.write("錯誤碼: " + (e.number & 0xFFFF) + "<br>");
document.write("錯誤說明(message): " + e.message + "<br>");
document.write("錯誤說明(description): " + e.description + "<br>");
}
finally {
// 顯示測試值
document.write("<hr>測試值x = " + x + "<br>");
}
</script>
}
catch(e){
// 錯誤處理的程式碼
document.write("錯誤碼: " + (e.number & 0xFFFF) + "<br>");
document.write("錯誤說明(message): " + e.message + "<br>");
document.write("錯誤說明(description): " + e.description + "<br>");
}
finally {
// 顯示測試值
document.write("<hr>測試值x = " + x + "<br>");
}
</script>
沒有留言:
張貼留言