This commit is contained in:
81
src/index.html
Normal file
81
src/index.html
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Rate mal!</title>
|
||||
</head>
|
||||
|
||||
<body id="Seite">
|
||||
Rate meine
|
||||
<span style="color: rgb(4, 0, 255)">
|
||||
<strong>
|
||||
Zahl
|
||||
</strong>
|
||||
</span>
|
||||
<div class="center" style="margin-top: 20vh;">
|
||||
<div>
|
||||
<strong>
|
||||
Rate mal nh Zahl zwischen 1 und 10..!
|
||||
</strong>
|
||||
</div>
|
||||
<input type="number" id="InpZahl" min="1" max="10" autofocus />
|
||||
<button id="BtnRate" onclick="Raten()">Rate</button>
|
||||
|
||||
<div>
|
||||
<label id="lblRichtig"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<label id="lblZaehler" style="position: absolute; bottom: 5px; z-index: 0;">Zähler: 0</label>
|
||||
|
||||
<img src="https://i.gifer.com/4M57.gif" style="width: 100vw; position: absolute; top: 0; display: none;" id="ImgWin">
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<style>
|
||||
.center {
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
const MAXZAHL=10
|
||||
|
||||
let Zahl=Math.ceil(
|
||||
Math.random()*MAXZAHL
|
||||
)
|
||||
let Zaehler=0
|
||||
|
||||
function Raten() {
|
||||
let InpZahl=document.getElementById("InpZahl")
|
||||
let Geraten=+InpZahl.value
|
||||
console.log("Geraten: ", Geraten)
|
||||
|
||||
let lblRichtig=document.getElementById("lblRichtig")
|
||||
let BtnRate=document.getElementById("BtnRate")
|
||||
let ImgWin=document.getElementById("ImgWin")
|
||||
let Seite=document.getElementById("Seite")
|
||||
|
||||
if (Geraten==Zahl) {
|
||||
lblRichtig.innerHTML="Richtig"
|
||||
lblRichtig.style.color="black"
|
||||
BtnRate.disabled=true
|
||||
Seite.style.backgroundColor="green"
|
||||
ImgWin.style.display="block"
|
||||
} else {
|
||||
lblRichtig.innerHTML="Falsch"
|
||||
lblRichtig.style.color="black"
|
||||
Seite.style.backgroundColor="red"
|
||||
}
|
||||
|
||||
let lblZaehler=document.getElementById("lblZaehler")
|
||||
Zaehler=Zaehler+1
|
||||
lblZaehler.innerHTML="Zähler: "+Zaehler
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user