else

elseはif()で書かれた条件を満たしていない場合に別の処理を行います。

構文

if(条件式)... else ...
if(条件式) {...} else {...}

例文

<html>
 <head>
  <title>else</title>
</head>
 <body>
  <script type="text/javascript"><!--
  var count = 1;
  if (count == 1) {
   document.write("1です");
  }else{
   document.write("1以外です");
  }
  // --></script>
 </body>
</html>

関連記事

スポンサーリンク

ファイルを削除する/フォルダを削除する

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

上に戻る