-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodepre.txt
More file actions
113 lines (110 loc) · 3.24 KB
/
codepre.txt
File metadata and controls
113 lines (110 loc) · 3.24 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE HTML>
<html>
<head>
<style>
body{
background-color: white;
}
#borderb{
width:200px;
height: 20px;
position: fixed;
left:27%;
top:48%;
border: solid black 3px;
border-radius: 20px;
}
#plusx{
position:fixed;
top:65%;
display: none;
width: 30px;
height: 30px;
}
#plusy{
position:fixed;
top:65%;
display: none;
width: 30px;
height: 30px;
}
#borderc{
width:200px;
height: 20px;
position: fixed;
left:28%;
top:48.5%;
border: solid black 0px;
border-radius: 20px;
background-color: #20e843;
}
#borderd{
position: fixed;
left:50%;
top:50%;
}
</style>
</head>
<body>
<label>Max Level:</label><input placeholder="Your num in int form" type="number" id="inputa">
<button id="submita" onclick="Gotnum()">Submit</button>
<label style="position: fixed; top:48%; left:15%; font-size:25px;" id="fun">🔇</label><span id="borderb"></span>
<span id="borderc"></span><h3 id="borderd"></h3>
<button id="plusx" onclick="plus()" style="background-color:#01ea34; left:20%;">+</button><h3> </h3><button id="plusy" onclick="minus()" style="background-color:#ff0000; left:80%;">-</button>
<button style="width:60px; height:40px; background-color:#9a0fd0; color:white; position: fixed; top:80%; left:80%;" href="codepre.html">code--></button>
</body>
</html>
<script>
alert("enter the max number that you want in the input box to start the number bar")
var widht = 0;
var cont = 0;
var inptu = document.getElementById("inputa").value;
var total = 0;
function Gotnum(){
document.getElementById("borderc").style.width=0+"px";
total = 0;
cont = 0;
inptu = Number(document.getElementById("inputa").value);
var testa = Math.floor(inptu);
var testb = inptu-testa
if(testb!=0){
alert("This assigning bar is only made for int numbers, so please input int numbers (ex:- natural numbers)")
inptu-inptu;
}
widht = 200/inptu
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
document.getElementById("plusx").style.display="block"
document.getElementById("plusy").style.display="block"
document.getElementById("submita").innerHTML="replace"
document.getElementById("fun").innerHTML="🔇"
}
function plus(){
if(cont!=inptu){
total+=widht;
cont+=1;}
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
document.getElementById("borderc").style.width=total+"px";
if(cont>0){
document.getElementById("fun").innerHTML="🔊"
}
else{
document.getElementById("fun").innerHTML="🔇"
}
}
function minus(){
if(cont!=0){
total-=widht;
cont-=1;}
if(cont>0){
document.getElementById("fun").innerHTML="🔊"
}
else{
document.getElementById("fun").innerHTML="🔇"
}
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
document.getElementById("borderc").style.width=total+"px";
if(cont == 0){
document.getElementById("borderc").style.width=0+"px";
}
}
</script>