-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathskrypt1.js
More file actions
39 lines (31 loc) · 720 Bytes
/
skrypt1.js
File metadata and controls
39 lines (31 loc) · 720 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
function count()
{
var nr1 = document.getElementById("num1").value;
var nr2 = document.getElementById("num2").value;
var f = document.getElementsByName("radio");
var v ;
for(var i = 0; i < 4; i++)
{
if(f[i].checked){
v = i+1;
}
};
switch (v){
case 1:
total = (nr1*1 + nr2*1);
break;
case 2:
total = nr1 - nr2;
break;
case 3:
total = nr1 * nr2;
break;
case 4:
if (nr2==0) {
total = "You can not divide by zero!"}
else {
total = nr1 / nr2;
break;}
}
document.getElementById("result").innerHTML=(total);
}