...
Below code shows increased number in innerHTML every 3 seconds
| Code Block | ||
|---|---|---|
| ||
<html>
<script>
var myCnt=0;
function alertFunc() {
myCnt++;
document.getElementById( "main").innerHTML = myCnt;
setTimeout(alertFunc, 3000); // repeat the same event
}
setTimeout(alertFunc, 3000);
</script>
<body><div id="main">
</div>
</body>
</html> |
...