samedi 18 avril 2015

javascript confirm() terminate my script when dialog opened

i have script for showing seconds of the hour, demo jsfiddle here


following my script :



<script type="text/javascript">
function updateClock() {
var now = new Date();
var seconds = now.getSeconds();

var elem = document.getElementById('clock');
elem.innerHTML = seconds;
}

function confirma(){
confirm('confirmation?');
}
</script>

<body onload="setInterval('updateClock()', 200);">
<h1 id="clock"></h1>
<button onclick="confirma()">confirm!</button>
</body>


my script works well, but when i click button "confirm!", the seconds not increase (freeze), why?


Aucun commentaire:

Enregistrer un commentaire