Jump to content

Help please?


GetReady

Recommended Posts

You can call a function in javascript after certain period of time by using setTimeout... Below is the example.. Hopefully it will give you a better idea.. and you can achieve what you want to do...

 

<html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount(){
	document.getElementById('txt').value=c;
	c=c+1;
	t=setTimeout("timedCount()",1000); // 1000 is milisecond
}

function doTimer(){
	if (!timer_is_on){
	  timer_is_on=1;
	  timedCount();
  }
}
</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onClick="doTimer()">
<input type="text" id="txt" />
</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/200847-help-please/#findComment-1053971
Share on other sites

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.