-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjava.js
More file actions
85 lines (53 loc) · 1.64 KB
/
java.js
File metadata and controls
85 lines (53 loc) · 1.64 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var click=10
function getIncrement()
{
document.getElementById('display').style.background="white"
document.getElementById('display').innerHTML=""
click+=1;
document.getElementById("inp").value=click
}
function getDecrement()
{
document.getElementById('display').style.background="white"
document.getElementById('display').innerHTML=""
click-=1;
document.getElementById("inp").value=click
}
function setDefault(){
document.getElementById('display').style.background="white"
document.getElementById("display").innerHTML=""
document.getElementById("inp").value=10
click=10
clearInterval(myVar);
}
function counterBegins()
{
if(click>0){
var myVar = setInterval(function(){
click --;
document.getElementById('inp').value=click
if(click==0){
clearInterval(myVar)
document.getElementById('display').innerHTML="Alert!!!<br>..................<br> value reached zero"
document.getElementById('display').style.background="red"
}
else{
document.getElementById('display').style.background="white"
}
},1000);
}
else{
var myVar = setInterval(function(){
click ++;
document.getElementById('inp').value=click
if(click==0){
clearInterval(myVar)
document.getElementById('display').innerHTML="Alert!!!<br>..................<br> value reached zero"
document.getElementById('display').style.background="red"
}
else{
document.getElementById('display').style.background="white"
}
},1000);
}
}