JavaScript: Exemplo de uso do setInterval

From AdonaiMedrado.Pro.Br
Revision as of 23:18, 12 September 2008 by Adonaimedrado (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
<html>
  <head>
    <title>Minha Página</title>
  </head>  
  <body>
    <input type="text" id="txtMeuContador" />
    <script language="javascript">
      var i = 0;
      function f()
      {
	   document.getElementById("txtMeuContador").value = i++;
      }
      setInterval(f, 500);
    </script>
  </body>
</html>