<!DOCTYPE html>
<html>
<head></head>
<body>
<p id="p-id"></p>
<script>
setInterval(function () {count()}, 1000);
var counter = 0;
function count()
{
counter++;
document.getElementById("p-id").innerHTML = counter;
}
/*
run:
1 ... 2 ... 3 ...
*/
</script>
</body>
</html>