aboutsummaryrefslogtreecommitdiff
path: root/guessing.html
blob: fbd9bbb3b732435c3091ce7664d96954bb46ef17 (plain)
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
<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>