-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl.html
30 lines (26 loc) · 922 Bytes
/
l.html
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
<center style="background-color:aquamarine;border-color:black;border-style:ridge;border-width: 5px;display:inline-block;padding: 90px;margin: 70px;margin-left: 330px;">
<h1 style=>Guess the Number from 1 to 10🧐</h1>
<input id="lav" placeholder="🤔.....">
<button onclick="change()">Enter</button>
<h3 id="result">wrong/right</h3>
<h3 id="chance">score:10 </h3>
</center>
<script>
var inp = document.getElementById("lav")
var res = document.getElementById("result")
var ran = Math.floor(Math.random()*10)+1
var score = 10
function change(){
var val = inp.value
if(ran!=val){
result.textContent="Wrong❌"
score = score-1
chance.textContent="score:"+score+"😔"
}
else{
result.textContent="Right✔️"
alert("you won!🏆")
chance.textContent="score:"+score+"😀"
}
}
</script>