-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtask4.html
34 lines (28 loc) · 1.09 KB
/
task4.html
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 lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="number" id='prv'> <input type="number" id='vtor'><italic> i</italic> <br>
<input type="number" id='tret'> <input type="number" id='chetvorti'><italic> i</italic><br>
<button onclick="calculate()">Add</button>
<br>
<input type="number" id='petti'> <input type="number" id='shesti'><italic> i</italic>
</body>
<script>
function calculate(){
var prv = document.getElementById('prv').value
var vtor = document.getElementById('vtor').value
var tret = document.getElementById('tret').value
var chetvorti = document.getElementById('chetvorti').value
var pettiV = document.getElementById('petti')
var shestiV = document.getElementById('shesti')
pettiV.value = parseInt(prv) + parseInt(tret);
shestiV.value = parseInt(vtor) + parseInt(chetvorti);
}
</script>
</html>