practice11(학점입력받아 출력).html
879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>practice10</title>
</head>
<body>
학점:
<input type="text" name="" value="" id="input1">
<input type="button" name="" value="입력" onclick="call()">
<div id = "div1">
</div>
<script type="text/javascript">
function call(){
var score = document.getElementById("input1").value;
if(score!=""){
var temp= document.getElementById("div1");
if(score>= 90){
temp.innerHTML = "<h1>your grade is A</h1> ";
}else if(score>=80 &&score<=89){
temp.innerHTML = "<h1>your grade is B</h1> ";
}else if(score>=70 &&score<=79){
temp.innerHTML = "<h1>your grade is C</h1> ";
}else{
temp.innerHTML = "<h1>your grade is F</h1> ";
}
}
}
</script>
</body>
</html>