Jump to content

help creating a counter


svgmx5

Recommended Posts

Sure, you can use the javascript setInterval function.  Here's a sample that sets up a form element and updates it every 2 seconds.

 





<br />
function init() {<br />
  document.forms["form1"].counter.value=0;<br />
}<br />
<br />
function updateCounter(){<br />
  document.forms["form1"].counter.value++;<br />
}<br />
<br />
window.onload=function(){<br />
  init();<br />
  setInterval(updateCounter, 2000);<br />
}<br />

</pre>
<form name="form1">
Counter: 
</form>
<br><b

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.