teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

インデントを加えました

2019/07/13 03:13

投稿

hisayan
hisayan

スコア60

title CHANGED
File without changes
body CHANGED
@@ -5,17 +5,17 @@
5
5
  <html>
6
6
  <body>
7
7
  <script>
8
- let text = prompt("年齢は?");
8
+      let text = prompt("年齢は?");
9
- if(isNaN(text)){
9
+            if(isNaN(text)){
10
- document.write("無意味な文字列です");
10
+              document.write("無意味な文字列です");
11
- }
11
+                    }
12
- let age = parseInt(text);
12
+      let age = parseInt(text);
13
- if(age>=6 && age<=15){
13
+            if(age>=6 && age<=15){
14
- document.write("義務教育の対象です");
14
+              document.write("義務教育の対象です");
15
- }
15
+                    }
16
- else{
16
+          else{
17
- document.write("対象外です");
17
+             document.write("対象外です");
18
- }
18
+            }
19
19
  </script>
20
20
  </body>
21
21
  </html>

1

タブで整理して一部記述を変更しました。

2019/07/13 03:13

投稿

hisayan
hisayan

スコア60

title CHANGED
File without changes
body CHANGED
@@ -19,4 +19,22 @@
19
19
  </script>
20
20
  </body>
21
21
  </html>
22
+ ``````以下のようにしてもダメでした。
22
- ```
23
+ コード
24
+ <html>
25
+ <body>
26
+ <script>
27
+ let text = prompt("年齢は?");
28
+ let age = parseInt(text);
29
+ if(isNaN(text)){
30
+ document.write("無意味な文字列です");
31
+ }
32
+ elseif(age>=6 && age<=15){
33
+ document.write("義務教育の対象です");
34
+ }
35
+ else{
36
+ document.write("対象外です");
37
+ }
38
+ </script>
39
+ </body>
40
+ </html>