Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button inactive after 60secs

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
GB
I am looking to instigate a button that becomes inactive after 60secs.
Ideally I would like a count down within the button. Have seen this, mostly on broker websites but would appreciate any help.
 
Was hoping it was something simple enough to do myself.
 
found this elsewhere on the site and have tried to adapt but not 100% sure what I'm doing
Code:
		<script language="JavaScript">
		var timerID = 0;
		var gseconds = 0;
		function UpdateTimer() {
		    gseconds += 1;
		    timerID = clearTimeout(timerID);
		    document.AXConfirm.theTime.value = gseconds;    
		    Start();
		}
		function Start() {
		    document.getElementById("ConfirmButton").disabled = true;
		    tStart    = new Date();
		    timerID  = setTimeout("UpdateTimer()", 10);
		}
		function Stop() {
		    document.getElementById("ConfirmButton").disabled = true;
		    if(timerID) {
		        clearTimeout(timerID);
		        timerID  = 0;
		    }
		}
		function Reset() {
		    document.getElementById("ConfirmButton").disabled = true;
		    document.AXConfirm.theTime.value = "0";
		    clearTimeout(timerID);
		    timerID  = 0;
		    gseconds = 0;
		}
		</script>
and the form
Code:
		<script>
		UpdateTimer();
		</script>
		<FORM action="index.cfm" name="AXConfirm">
		<input type="text" name="theTime">
		<input type="hidden" name="AllocatedTo" value="#EIN#">
		<input type="hidden" name="Allocate" value="#Generate.NewAX#">
		<input type="Button" name="Confirm" value="Confirm" style="color: White; background-color: Green;">
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="Submit" name="Reject" value="Reject" style="color: White; background-color: Red;">
		</FORM>
I get an error on document.AXConfirm.theTime.value = gseconds; saying it is null or not an object
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top