diff options
Diffstat (limited to 'guessing.html')
-rwxr-xr-x | guessing.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/guessing.html b/guessing.html new file mode 100755 index 0000000..fbd9bbb --- /dev/null +++ b/guessing.html @@ -0,0 +1,66 @@ +<html><head> + <meta charset="utf-8"> + <style type="text/css"> + body { background-color:lightyellow; } + div { width:15em; height: 6em; padding:1em;margin:1em;background-color:lightgreen; text-align:center;} + div.blauer {background-color:lightblue;} + </style> + <script> + + var a = []; + var t = []; + var b=[1,2,3,4,5]; + setTimeout(setzen,100); + function setzen(){ + document.getElementById('punkte').value=0; + a=[3,2,5,1,4]; + document.getElementById('b1').innerHTML=a[0]; + document.getElementById('b2').innerHTML=a[1]; + document.getElementById('b3').innerHTML=a[2]; + document.getElementById('b4').innerHTML=a[3]; + document.getElementById('b5').innerHTML=a[4]; + } + function controll(){ + document.getElementById('b1').innerHTML=a[0]; + document.getElementById('b2').innerHTML=a[1]; + document.getElementById('b3').innerHTML=a[2]; + document.getElementById('b4').innerHTML=a[3]; + document.getElementById('b5').innerHTML=a[4]; + + + if(a.join() == b.join()){ + window.alert("DONE! Bad Points: "+document.getElementById('punkte').value); + location.reload(); + } + } + function change(number){ + for(i=0;i < number;i++){ + t.push(a.shift()); + } + for(i=0;i < number;i++){ + a.unshift(t.shift()); + } + var c = parseInt(document.getElementById('punkte').value); + document.getElementById('punkte').value = c + 1; + controll(); + } +</script> +</head> +<body> + <h1>Guessing Game</h1> + <p>Switch the nubers till they are in the correct order!</p> + <div style="background-color:pink"> + <button id="b1" onclick="change(1)"></button> + <button id="b2" onclick="change(2)"></button> + <button id="b3"onclick="change(3)"></button> + <button id="b4"onclick="change(4)"></button> + <button id="b5"onclick="change(5)"></button> + </div> + <div> + <h3>BAD POINTS</h3> + <input type="number"readonly id="punkte" value="0" /> + </div> +</body> + +</html> + |