finally

finally{}はtryで発生したエラーの後に必ず処理する命令を指定することができます。

構文

finally { ... }

例文

<html>
 <head>
  <title>finally</title>
</head>
 <body>
  <script type="text/javascript"><!--
  try {
   v = javascript.version;
   document.write("Version = "+v);
  }catch(e){
   document.write("Error = "+e);
  }finally{
   document.write("<br>エラーが発生しました");
  }
  // --></script>
 </body>
</html>

関連記事

スポンサーリンク

Beep音を無効にする

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る