-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo11.html
More file actions
34 lines (33 loc) · 838 Bytes
/
Copy pathDemo11.html
File metadata and controls
34 lines (33 loc) · 838 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
<!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 số :
<input type="number" id="input_so">
<br>
<button type="button" onclick="nhap()">Nhập</button>
<button type="button" onclick="in_ra()">In ra danh sách các số đã nhập vào</button>
</form>
<div id="ket_qua"></div>
<script type="text/javascript">
let mang = [];
function nhap(){
let so = parseFloat(document.getElementById('input_so').value);
mang.push(so);
document.getElementById('input_so').value ='';
}
function in_ra() {
let chuoi = '';
for (let i = 0; i < mang.length; i++){
chuoi += mang[i] + '<br>'
}
document.getElementById('ket_qua').innerHTML = chuoi;
}
</script>
</body>
</html>