Showing
3 changed files
with
91 additions
and
0 deletions
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | + <head> | ||
4 | + <meta charset="utf-8"> | ||
5 | + <title>practice10</title> | ||
6 | + </head> | ||
7 | + <body> | ||
8 | + <input type="text" name="" value="" id="input1"> | ||
9 | + <input type="button" name="" value="입력" onclick="call()"> | ||
10 | + | ||
11 | + <div id = "div1"> | ||
12 | + | ||
13 | + </div> | ||
14 | + <script type="text/javascript"> | ||
15 | + function call(){ | ||
16 | + // var birth = prompt("생년월일을 입력해주세요","6자리 입력"); | ||
17 | + | ||
18 | + var birth = document.getElementById("input1").value; | ||
19 | + if(birth!=""){ | ||
20 | + var temp= document.getElementById("div1"); | ||
21 | + var a = birth.substr(0,2); | ||
22 | + var b = birth.substr(2,2); | ||
23 | + var c = birth.substr(4,2); | ||
24 | + //temp.innerHTML = birth.length; | ||
25 | + temp.innerHTML = "생일:19"+a+"년 "+b+"월 "+c+"일"; | ||
26 | + } | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + } | ||
31 | + </script> | ||
32 | + </body> | ||
33 | +</html> |
자바스크립트/practice11(학점입력받아 출력).html
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html> | ||
3 | + <head> | ||
4 | + <meta charset="utf-8"> | ||
5 | + <title>practice10</title> | ||
6 | + </head> | ||
7 | + <body> | ||
8 | + 학점: | ||
9 | + <input type="text" name="" value="" id="input1"> | ||
10 | + <input type="button" name="" value="입력" onclick="call()"> | ||
11 | + | ||
12 | + <div id = "div1"> | ||
13 | + | ||
14 | + </div> | ||
15 | + <script type="text/javascript"> | ||
16 | + function call(){ | ||
17 | + | ||
18 | + | ||
19 | + var score = document.getElementById("input1").value; | ||
20 | + if(score!=""){ | ||
21 | + var temp= document.getElementById("div1"); | ||
22 | + if(score>= 90){ | ||
23 | + temp.innerHTML = "<h1>your grade is A</h1> "; | ||
24 | + }else if(score>=80 &&score<=89){ | ||
25 | + temp.innerHTML = "<h1>your grade is B</h1> "; | ||
26 | + }else if(score>=70 &&score<=79){ | ||
27 | + temp.innerHTML = "<h1>your grade is C</h1> "; | ||
28 | + }else{ | ||
29 | + temp.innerHTML = "<h1>your grade is F</h1> "; | ||
30 | + } | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + } | ||
39 | + </script> | ||
40 | + </body> | ||
41 | +</html> |
-
Please register or login to post a comment