} catch(e){ // e代表抛出的异常 }终于{ //代码总是执行,是否抛出异常 } 一个try语句没有'不需要捕获和最终条款,但 必须至少包含其中一个。 这是对语言的最新补充。像NN4这样的浏览器在遇到这些关键字时会出现错误,因为它们是在 时间内保留的。 IE5,Netscape 6和Mozilla将支持try..catch。当Opera开始支持时,我不知道 。 您确定需要使用这些声明吗? Mike - Michael Winter 替换.invalid与.uk通过电子邮件回复。 var e; try { // Execute exception-causing code here } catch(e) { // e represents the exception thrown } finally { // Code always executed, whether an exception was thrown or not } A try statement doesn''t require both of the catch and finally clauses, butat least one of them must be included. This is a fairly recent addition to the language. Browsers like NN4 willerror when encountering these keywords as they were reserved during thattime. IE5, Netscape 6 and Mozilla will support try..catch. I don''t knowwhen Opera began support. Are you certain you need to use these statements? Mike --Michael WinterReplace ".invalid" with ".uk" to reply by e-mail. 你完成了这个条款: try {} catch(e){} finally { } 是的,它最近都被添加到了JavaScript和JScript中。在实际的脚本中,它从未见过它。要么没用多少,要么有些实现错误,或者我都不知道。从使用它的人那里得到一些反馈会很棒。 You ment the clause: try {} catch (e) {} finally{} Yes, it has been relatively recently added to both JavaScript and JScript. Never seen it in use yet though in actual scripts. Either no much use, or some implementation errors, or I don''t know. Would be great to get some feed-back from who ever used it. 这篇关于sintax尝试和除了istruction的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 14:12