Io les gens.
Bon me suis fait un script pour avoir un chrono, dans mon appli.
Me suis dis, jouer avec Date, pour la gestion, c'estle mieux...mais maybe il y a encore plus simple:
Script a l'arache :
Code :
- <html>
- <head>
- <script type="text/javascript">
- var today=new Date();
- var startT=today.getTime();
- function startTime()
- {
- var today2=new Date();
- today.setTime(today2.getTime()-startT);
- var h=today.getUTCHours();
- var m=today.getUTCMinutes();
- var s=today.getUTCSeconds();
- m=checkTime(m);
- s=checkTime(s);
- h=checkTime(h);
- document.getElementById('txt').innerHTML=h+":"+m+":"+s;
- t=setTimeout('startTime()',500);
- }
- function checkTime(i)
- {
- if (i<10)
- {
- i="0" + i;
- }
- return i;
- }
- </script>
- </head>
- <body onload="startTime()">
- <div id="txt"></div>
- </body>
- </html>
|
thx