04.条件処理
前章まで式や論理式の記述方法を学びましたが、
これらを使ってよりプログラムらしいスクリプトを記述してみましょう。
条件処理で代表的なものにはif~else文、またループ処理には for文、while文などがあります。
コマンド
①if~else文
②for文
③for~in文
④while文
⑤break文
ページ | 実行ファイル | ソース | コメント |
---|---|---|---|
<13p> | 13p.html | 13p_js | ●aは10以上です |
13p1.html | 13p1_js | ●aは10以上です | |
13p2.html | 13p2_js | ●aは5以上で8です |
<14p> | 14p_1.html | 14p_1_js | ●給料日前です |
---|---|---|---|
14p9_1.html | 14p9_1_js | ●navigator.appName | |
14p9_2.html | 14p9_2_js | ●ブラウザの判断 | |
14p9_11.html | 14p9_11_js | ●午前中と午後を表示 |
<15p> | 15p1_2.html | 15p1_2_js | ●こんばんは |
---|---|---|---|
15p1_11.html | 15p1_11_js | ●document.bgColor="" |
<16p> | 16p.html | 16p_js | ●初期a=1、終了aが150 |
---|---|---|---|
16p_1.html | 16p_1_js | ●継続処理に1を足して | |
16p_7.html | 16p_7_js | ●継続処理に1を足して | |
16p_8.html | 16p_8_js | ●継続処理に1を足して | |
16p_9.html | 16p_9_js | ●初期a=1、終了aが-20の時 |
<17p> | 17p_2.html | 17p_2_js | ● |
---|---|---|---|
17p_3.html | 17p_3_js | ● | |
17p_5.html | 17p_5_js | ●ナビゲータfor(i in navigator) | |
17p_6.html | 17p_6_js | ●ナビゲータfor(i in window) |
<18p> | 18p.html | 18p_js | ●文字のサイズは"i" |
---|---|---|---|
18p_1.html | 18p_1_js | ●文字のサイズは"i" |
<19p> | 19p.html | 19p_js | ●パスワード設定 |
---|---|---|---|
19p_1.html | 19p_1_js | ●パスワード設定 |