admin | Дата: Четверг, 19.09.2013, 21:28 | Сообщение # 1 |
Главный админ
Группа: Администраторы
Сообщений: 336
Награды: 0
Репутация: 1
Статус: Offline
| Checkbox
Смысл игры в том, чтобы как можно быстрее найти ту ячейку, в которую невозможно поставить галочку.
<html> <head> <title>Checkbox</title> <SCRIPT LANGUAGE="JavaScript"> <!-- // assign initial values to global variables var total = 0 var play = false // react to a click in a checkbox (element == clicked checkbox object) function display(element) { // assign instance of Date object representing current time var now = new Date() // if the game has not started yet if (!play) { // game starts now play = true // milliseconds since 1970 for time at beginning startTime = now.getTime() } // if more than 20 seconds have passed since startTime was last set if (now.getTime() - startTime > 20000) { // reject modification (make "read-only") element.checked = !element.checked // terminate function return } // if the clicked checkbox is now checked if (element.checked) // increment total total++ else // decrement total total-- // display total in text object element.form.num.value = total } function restart(form) { // set global variables back to initial values total = 0 play = false // uncheck all 100 checkboxes for (var i = 1; i <= 100; ++i) { // uncheck current checkbox form.elements.checked = false } } // --> </SCRIPT> <body> <SCRIPT LANGUAGE="JavaScript"> <!-- // immediate script (executed before the other script because it is deferred) document.write("<FORM><CENTER>") document.write('<INPUT TYPE="text" VALUE="0" NAME="num" SIZE=10 onFocus="this.blur()"><BR>') document.write("<HR SIZE=1 WIDTH=40%>") // use loop to create a 10 x 10 square of checkboxes for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { // write checkbox with "display(this)" as event handler script document.write('<INPUT TYPE="checkbox" onClick="display(this)">') } document.write("<BR>") } document.write("<HR SIZE=1 WIDTH=40%>") // create button to call restart function to restart game document.write('<INPUT TYPE="button" VALUE="restart" onClick="restart(this.form)">') document.write("</CENTER></FORM>") // --> </SCRIPT> <center><em>Смысл игры в том, чтобы как можно быстрее найти<BR> ту ячейку, в которую невозможно поставить галочку.</em></center> <!--s_links-->Portalbilet.ru <a href="http://www.portalbilet.ru/catalog/?theatre_id=4&perfomance_id=1849" target="_blank">цирк дю солей 24 часа</a>.<!--/s_links--> <!-- copyright (i1) --><div align="center"><a href="http://www.ucoz.ru/" title="Создать сайт бесплатно"><img style="margin:0;padding:0;border:0;" alt="Hosted by uCoz" src="http://s206.ucoz.net/img/cp/5.gif" width="80" height="15" title="Hosted by uCoz" /></a><br /></div><!-- /copyright --> </body> </html><div><span id="openstat2323431"></span><script type="text/javascript">var openstat = { counter: 2323431, next: openstat };(function(d, t, p) {var j = d.createElement(t); j.async = true; j.type = "text/javascript";j.src = ("https:" == p ? "https:" : "http:") + "//openstat.net/cnt.js";var s = d.getElementsByTagName(t)[0]; s.parentNode.insertBefore(j, s);};)document, "script", document.location.protocol);</script><script type="text/javascript">new Image().src = "http://counter.yadro.ru/hit;narodcounter?r"+escape(document.referrer)+((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+";"+Math.random();</script></div>
|
|
| |