-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproj.js
30 lines (20 loc) · 859 Bytes
/
proj.js
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
function calc1(){
var num1 = parseFloat(document.getElementById('num1').value);
var num2 = parseFloat(document.getElementById('num2').value);
var n = document.getElementById('input');
if(document.getElementById('add').checked){
sum = num1 + num2;
n.value = sum;
} if(document.getElementById('sub').checked){
sub = num1 - num2;
n.value = sub;
} if(document.getElementById('div').checked){
div = num1 / num2;
n.value = div;
} if(document.getElementById('mul').checked){
mul = num1 * num2;
n.value = mul;
} if(document.getElementById('add').checked == false && document.getElementById('sub').checked == false && document.getElementById('div').checked == false && document.getElementById('mul').checked == false){
n.value = 'Invalid Operation'
}
}