Javascript examples for DOM HTML Element:Div
count value with timer and set to div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w ww .j a v a 2s. c om function animateValue(id){ var obj = document.getElementById(id); var current = obj.innerHTML; setInterval(function(){ obj.innerHTML = current++; },1000); } animateValue('value'); } </script> </head> <body> <div id="value"> 100 </div> </body> </html>