Difference between revisions of "JavaScript: Exemplo de uso do setInterval"
From AdonaiMedrado.Pro.Br
(New page: <code lang="javascript"> <html> <head> <title>Minha Página</title> </head> <body> <input type="text" id="txtMeuContador" /> <script language="javascript"> var i ...) |
|||
Line 10: | Line 10: | ||
function f() | function f() | ||
{ | { | ||
− | + | document.getElementById("txtMeuContador").value = i++; | |
} | } | ||
setInterval(f, 500); | setInterval(f, 500); |
Latest revision as of 23:18, 12 September 2008
<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>