showing results for - "get local time second javascript heure temps r c3 a9el"
Michael
14 Jun 2016
1<body>
2  <p>Il est <span id="time"></span>.</p>
3  <button id="stop">Stop time</button>
4<script>
5    let hour = document.getElementById("time");
6	let stop = document.getElementById("stop");
7	let realTime = setInterval(clock, 1000);
8	
9	function clock(){
10    	let d = new Date();
11    	hour.innerHTML = d.toLocaleTimeString();
12    	}
13    stop.addEventListener ("click", arret);
14    function arret() {
15    	clearInterval(realTime);
16    }
17</script>
18</body>