STOPKY

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

092
p092.html / p092.zip
Stopky
1336b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<html> <head> <title> JavaScript DESTINATION - P092 </title> <script language="JavaScript"> <!-- var timerRunning = false var timerID = null var initial = new Date() function start() { document.forms[0].general.value = "stop" document.forms[0].general.onclick = stop if (confirm("Mam vynulovat stopky ?")) initial = new Date() startTime = initial.getTime() stopTimer() showTimer() } function stop() { document.forms[0].general.value = "start" document.forms[0].general.onclick = start stopTimer() } function stopTimer() { if (timerRunning) clearTimeout(timerID) timerRunning = false } function showTimer() { var current = new Date() var curTime = current.getTime() var dif = curTime - startTime var result = dif / 1000 if (result < 1) result = "0" + result result = result.toString() if (result.indexOf(".") == -1) result += ".00" if (result.length - result.indexOf(".") <= 2) result += "0" document.forms[0].display.value = result timerID = setTimeout("showTimer()", 0) timerRunning = true } // --> </script> </head> <body> <FORM> <INPUT TYPE="text" NAME="display" VALUE="" onFocus="this.blur()"> <INPUT TYPE="button" NAME="general" VALUE="start" onClick="start()"> </FORM> </body> </html>
[ Navrat / BACK ]