-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo10.html
More file actions
51 lines (51 loc) · 1016 Bytes
/
Copy pathDemo10.html
File metadata and controls
51 lines (51 loc) · 1016 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
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<form>
Nhập tháng:
<input type="number" id="input_thang" name="">
<br>
Nhập năm:
<input type="number" id="input_nam" name="">
<br>
<button type="button" onclick="in_ra()"> Kiểm tra xem có tối đa bao nhiêu ngày ăn chơi</button>
</form>
<div id="ket_qua"></div>
<script type="text/javascript">
function in_ra() {
// body...
let thang = parseFloat(document.getElementById('input_thang').value);
let ngay;
switch(thang){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
ngay = 31;
break;
case 4:
case 6:
case 9:
case 11:
ngay = 30;
break;
case 2:
ngay = 28;
break;
default:
ngay = 'sai';
break;
}
document.getElementById('ket_qua').innerHTML = 'Số ngay là: ' + ngay;
}
</script>
</body>
</html>