»
AnglaisFrançaisVietnamien

Imprimer - Stop the Clock! - JavaScriptBank.com

Version complète: jsB@nk » Game » Stop the Clock!
URL: https://www.javascriptbank.com/stop-the-clock.html

Stop the Clock! © JavaScriptBank.comTestez vos réflexes. Le but est d'arrêter le compteur à près de 500 que possible. La partie inférieure de votre client, le mieux. Pouvez-vous obtenir un score de 0?

Version complète: jsB@nk » Game » Stop the Clock!
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-->