»
Tiếng AnhTiếng PhápTiếng Việt

In - Tốc độ nhấp chuột - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trò chơi » Tốc độ nhấp chuột
URL: https://www.javascriptbank.com/mouse-click-tester-index.html

Tốc độ nhấp chuột © JavaScriptBank.comTrò chơi JavaScript JavaScript yêu cầu bạn nhấp chuột vào các ô vuông trong thời gian qui định với các cấp độ khác nhau.

Phiên bản đầy đủ: jsB@nk » Trò chơi » Tốc độ nhấp chuột
URL: https://www.javascriptbank.com/mouse-click-tester-index.html



JavaScript
<script language="JavaScript"><!-- Beginvar image_directory = "";var ok = false; var pcbusy = false; var userturn = true;var butdown = false;var stage = 1;var cnt = 1;var pcclicks = new Array();var userclicks = new Array();var pos;var tst = true;var msg = "Click Go!";btn1 = new Image();btn1.src = image_directory + "purple.gif";btn2 = new Image();btn2.src = image_directory + "yellow.gif";function updown(isdn) {if (isdn) {document.f[('pl'+pos)].src = image_directory + 'yellow.gif';}else {document.f[('pl'+pos)].src= image_directory + 'purple.gif';   }}function dopc() {document.f.st.value = stage;if (cnt <= stage) {pcbusy = true;userturn = false;document.f.s.value = "Simon's  Turn";setTimeout("pos=Math.floor((Math.random()*8)+1); updown(true)",500);setTimeout("updown(false) ; pcclicks[cnt]=pos; cnt++; dopc()",1200);}else {userclicks = new Array();cnt = 1;document.f.s.value = "Player's  Turn";pcbusy = false;userturn = true;document.f.b.focus();   }}function testclicks() {tst = true;for(i = 1;cnt > i; i++) {if (pcclicks[i] == userclicks[i]) {tst = true && tst;}else {tst = false && tst;   }}if(tst) {setTimeout("stage++ ; document.f.st.value=stage ; alert('That is correct!  Advancing to the next level....'); document.f.s.value=msg ; document.f.b.focus()",300);}else {setTimeout("stage=1 ; cnt=1 ; pcclicks=new Array() ; document.f.st.value=stage ; alert('Sorry, that is not correct.  Start a new game if you would like to play again.') ; document.f.s.value=msg",300);}cnt = 1;}function testclk(downflag, pos) {if (userturn&&(!pcbusy)) {if (downflag) {document.f[('pl'+pos)].src = image_directory + 'yellow.gif';}else{document.f[('pl'+pos)].src = image_directory + 'purple.gif';}if (ok && !downflag) {userclicks[cnt] = pos;cnt++;if (pcclicks.length == userclicks.length) {testclicks();         }      }   }}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="f"><table cellspacing="20" cols="5" width="600"><tbody><tr height="60"><td colspan="5" align="center"><img src="purple.gif" name="pl1" onmousedown="testclk(true,1)" onmouseup="testclk(false,1)" width="80" height="30"></td></tr><tr height="60"><td width="20%">&nbsp;</td><td align="center" width="20%"><img src="purple.gif" name="pl2" onmousedown="testclk(true,2)" onmouseup="testclk(false,2)" width="80" height="30"></td><td width="20%" align="center"><font size="3">Level<br></font><input type="text" size="2" value="1" name="st" readonly="readonly"></td><td align="center" width="20%"><img src="purple.gif" name="pl3" onmousedown="testclk(true,3)" onmouseup="testclk(false,3)" width="80" height="30"></td><td width="20%">&nbsp;</td></tr><tr height="60"><td align="center"><img src="purple.gif" name="pl4" onmousedown="testclk(true,4)" onmouseup="testclk(false,4)" width="80" height="30"></td><td align="center" colspan="3"><input type="text" name="s" value="Click 'Go!' to start" readonly="readonly" size="20"></td><td align="center"><img src="purple.gif" name="pl5" onmousedown="testclk(true,5)" onmouseup="testclk(false,5)" width="80" height="30"></td></tr><tr height="60"><td>&nbsp;</td><td align="center"><img src="purple.gif" name="pl6" onmousedown="testclk(true,6)" onmouseup="testclk(false,6)" width="80" height="30"></td><td align="center"><input type="button" value="    Go!    " name="b" onclick="ok=true ; if(!pcbusy) dopc()"></td><td align="center"><img src="purple.gif" name="pl7" onmousedown="testclk(true,7)" onmouseup="testclk(false,7)" width="80" height="30"></td><td>&nbsp;</td></tr><tr height="60"><td colspan="2" align="left"></td><td align="center"><img src="purple.gif" name="pl8" onmousedown="testclk(true,8)" onmouseup="testclk(false,8)" width="80" height="30"></td><td colspan="2" align="right"></td></tr></tbody></table></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/Mouse_click_tester/purple.gifhttp://javascriptbank.com/javascript/game/Mouse_click_tester/yellow.gif