Просмотр файла games/chisla/index.html
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
- <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
- <TITLE> Развлекательный Клуб </TITLE>
- <LINK
- href="favicon.ico" type=image/x-icon rel=icon><LINK href="../css.css" type=text/css
- rel=stylesheet>
- <BODY>
- <DIV class=title><B>Зрительная память на числа</B></DIV>
- <DIV class=kat><STRONG>
- <script>
- function loadgame() {
- v = -1; g = 0; tries = 0; total = 0
- for(var i = 0; i < 6; i++) {
- for(var j = 0; j < 6; j++) {
- v++
- document.write("<input type='button' value='????' style=\"width:70; height:60; font-size: 18pt; font-family: Verdana; font-weight: bold\" "+
- "OnClick='button(" +v+ ")'>")
- }
- document.write("<br>")
- }
- }
- function setBoard() {
- v = -1; g = 0; tries = 0; total = 0
- document.mem.start.value = "Старт"
- for(i=0; i<18; i++) {
- Array[i] = i; Array[i+18] = i
- }
- shuffle();
- }
- function shuffle() {
- for(i=0; i < (rand(300)+200); i++) {
- x = 0; y = 0
- while(x == y) {
- x = rand(36); y = rand(36)
- }
- temp = Array[x]; Array[x] = Array[y]; Array[y] = temp
- }
- show(0)
- }
- function rand(n) {
- return Math.floor(Math.random()*n)
- }
- function show(n) {
- if((n && confirm("Вы уверены? ")) || !n) {
- for(i=0; i<36; i++) {
- document.mem.elements[i].value = Array[i]
- }
- }
- }
- function blank() {
- for(i=0; i<36; i++) {
- document.mem.elements[i].value = ""
- }
- }
- function button(x) {
- test = "" +Array[x]
- if(test.charAt(0) == "[") return
- document.mem.elements[x].value = Array[x]
- if(g == 0) {
- first = Array[x]
- firstx = x;
- g++
- return
- }
- if(g == 1) {
- second = Array[x]
- secondx = x
- tries++
- g = 0
- if(first == second) {
- Array[firstx] = "[" +Array[firstx]+ "]"
- Array[secondx] = "[" +Array[secondx]+ "]"
- total++
- document.mem.start.value = "попаданий: "+total+""
- if(total == 18) alert("Вы открыли все числа после "+tries+" попыток(попытки)!")
- return
- }
- }
- setTimeout("document.mem.elements[firstx].value = ''", 500)
- setTimeout("document.mem.elements[secondx].value = ''", 500)
- }
- </script>
- <body OnLoad="setBoard()">
- <center>
- <table border="3" bgcolor="#808080">
- <tr><td bgcolor="#808080">
- <form name="mem">
- <script>
- loadgame()
- </script>
- <p><center>
- <input type="button" value="Старт" style="width:100" name="start" OnClick="blank()">
- <input type="button" value="Новая игра" OnClick="setBoard()">
- <input type="button" value="Сдаюсь!" OnClick="show(1)">
- </center></form>
- </table>
- <hr><p>
- <center>
- <a href="../">В развлекательный клуб</a>
- <BR><BR>
- <a href=../../index.html>На главную</a>
- <DIV class=end>
- <BR></CENTER></DIV></BODY></HTML>