Skip to content

Commit 9479766

Browse files
Add files via upload
1 parent 2933a9c commit 9479766

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

β€Žcodepre.txt

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<style>
5+
body{
6+
background-color: white;
7+
}
8+
#borderb{
9+
width:200px;
10+
height: 20px;
11+
position: fixed;
12+
left:27%;
13+
top:48%;
14+
border: solid black 3px;
15+
border-radius: 20px;
16+
17+
}
18+
#plusx{
19+
position:fixed;
20+
top:65%;
21+
display: none;
22+
width: 30px;
23+
height: 30px;
24+
}
25+
#plusy{
26+
position:fixed;
27+
top:65%;
28+
display: none;
29+
width: 30px;
30+
height: 30px;
31+
}
32+
#borderc{
33+
width:200px;
34+
height: 20px;
35+
position: fixed;
36+
left:28%;
37+
top:48.5%;
38+
border: solid black 0px;
39+
border-radius: 20px;
40+
background-color: #20e843;
41+
42+
}
43+
#borderd{
44+
position: fixed;
45+
left:50%;
46+
top:50%;
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
<label>Max Level:</label><input placeholder="Your num in int form" type="number" id="inputa">
52+
<button id="submita" onclick="Gotnum()">Submit</button>
53+
<label style="position: fixed; top:48%; left:15%; font-size:25px;" id="fun">πŸ”‡</label><span id="borderb"></span>
54+
<span id="borderc"></span><h3 id="borderd"></h3>
55+
<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>
56+
<button style="width:60px; height:40px; background-color:#9a0fd0; color:white; position: fixed; top:80%; left:80%;" href="codepre.html">code--></button>
57+
</body>
58+
</html>
59+
<script>
60+
alert("enter the max number that you want in the input box to start the number bar")
61+
var widht = 0;
62+
var cont = 0;
63+
var inptu = document.getElementById("inputa").value;
64+
var total = 0;
65+
function Gotnum(){
66+
document.getElementById("borderc").style.width=0+"px";
67+
total = 0;
68+
cont = 0;
69+
inptu = Number(document.getElementById("inputa").value);
70+
var testa = Math.floor(inptu);
71+
var testb = inptu-testa
72+
if(testb!=0){
73+
alert("This assigning bar is only made for int numbers, so please input int numbers (ex:- natural numbers)")
74+
inptu-inptu;
75+
}
76+
widht = 200/inptu
77+
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
78+
document.getElementById("plusx").style.display="block"
79+
document.getElementById("plusy").style.display="block"
80+
document.getElementById("submita").innerHTML="replace"
81+
document.getElementById("fun").innerHTML="πŸ”‡"
82+
}
83+
function plus(){
84+
if(cont!=inptu){
85+
total+=widht;
86+
cont+=1;}
87+
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
88+
document.getElementById("borderc").style.width=total+"px";
89+
if(cont>0){
90+
document.getElementById("fun").innerHTML="πŸ”Š"
91+
}
92+
else{
93+
document.getElementById("fun").innerHTML="πŸ”‡"
94+
}
95+
}
96+
function minus(){
97+
if(cont!=0){
98+
total-=widht;
99+
cont-=1;}
100+
if(cont>0){
101+
document.getElementById("fun").innerHTML="πŸ”Š"
102+
}
103+
else{
104+
document.getElementById("fun").innerHTML="πŸ”‡"
105+
}
106+
document.getElementById("borderd").innerHTML=cont+"/"+inptu;
107+
document.getElementById("borderc").style.width=total+"px";
108+
if(cont == 0){
109+
document.getElementById("borderc").style.width=0+"px";
110+
}
111+
}
112+
113+
</script>

0 commit comments

Comments
Β (0)