1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Zahlenraten</title>
</head>
<body>
<script type="text/javascript">
var Zufall = Math.round( Math.random() *100 ) ;
var Eingabe = prompt('Rate eine Zahl zwichen 0 und 100:' ) ;
while( Eingabe != Zufall ) {
if( Eingabe > Zufall ) {
Eingabe = prompt( Eingabe +' war zu groß. Nochmal:' ) ;
} else if( Eingabe < Zufall ) {
Eingabe = prompt( Eingabe +' war zu klein. Nochmal:' ) ;
}
}
alert( Eingabe +' war richtig!' ) ;
</script>
</body>
</html>
|