<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function rebour_multiple(tempsDebut,elem){ this.tempsDebut=parseInt(tempsDebut); this.elem=document.getElementById(elem); var that=this rebour(); function rebour(){ var date1 = new Date().getTime(); var date2 = new Date(tempsDebut).getTime(); var sec = (date1 - date2) / 1000; var n = 24 * 3600; var j = Math.floor (sec / n); var h = Math.floor ((sec - (j * n)) / 3600); var mn = Math.floor ((sec - ((j * n + h * 3600))) / 60); var sec = Math.floor (sec - ((j * n + h * 3600 + mn * 60))); j= j < 10 ? '0' + j : j; h= h < 10 ? '0' + h : h; mn= mn < 10 ? '0' + mn : mn; sec= sec < 10 ? '0' + sec : sec; that.elem.firstChild.nodeValue = j+' j '+h+' h '+mn+' mn '+sec+' s'; setTimeout(rebour, 1000); } } function initcompteur(){ new rebour_multiple('03/04/2013 12:55:20','tmp'); //date de debut new rebour_multiple('03/02/2013 21:38:16','tmp2'); //date de debut new rebour_multiple('03/06/2013 09:12:08','tmp3'); //date de debut } if(typeof window.addEventListener == 'undefined'){ window.attachEvent('onload', initcompteur); } else{ window.addEventListener('load', initcompteur, false); } </script> </head> 00/00/00/00 00/00/00/00 00/00/00/00 </html>
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question