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

In - Dừng đồng hồ - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trò chơi » Dừng đồng hồ
URL: https://www.javascriptbank.com/stop-the-clock.html

Dừng đồng hồ © JavaScriptBank.comHãy thử khả năng phản xạ của bạn thông qua trò chơi JavaScript JavaScript này. Trò chơi JavaScript JavaScript yêu cầu bạn dừng lại số càng gần 500 càng tốt.

Phiên bản đầy đủ: jsB@nk » Trò chơi » Dừng đồng hồ
URL: https://www.javascriptbank.com/stop-the-clock.html



JavaScript
<script type="text/javascript">// Created by: Kurtis Dinelle :: http://www.spamburger.netplaying=false;function startClock(){  if(playing==false) {    the_time=setInterval('document.game.timer.value++',1);  }  playing=true;}function stopClock() {  // You can change the two numbers ("500") below to a different value.  score=Math.abs(document.game.timer.value-500);  if(playing==true&&score<500) {    clearInterval(the_time);    alert('Your score is '+score+'.');    playing=false;    if(score==0) {      alert('Woo hoo! Perfect Score!');    }  document.game.timer.value=0;  }}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="game">  <input readonly type="text" name="timer" size="3" value="0">  <br><br>  <input type="button" value="Start" onclick="startClock()">  <input type="button" value="Stop" onclick="stopClock()"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->