Link to home
Start Free TrialLog in
Avatar of dcass
dcassFlag for United States of America

asked on

Timer - when 0 will display button to proceed.

I need an asp timer that will count down from 30 minutes onLoad and then at 0 seconds will display a button that will allow them to proceed.  In other words, they cannot proceed to the next page until the 30 minute timer is up, therefore I don't want the Proceed button to appear until the timer hits 0.  This should be a pretty simple proc for someone who knows javascript :)
ASKER CERTIFIED SOLUTION
Avatar of Louis01
Louis01
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcass

ASKER

The timer works great, but doesn't solve the button appearance problem.
Here is what I added, but it does not work.  It shows the timer, which is great, but never shows the button.  I've tried the timer as all kinds of field types, but can't get it to work.
<% if cstr(theTime) <> "0:0" then %>
        <input type=text name="theTime" size=3 readonly>
<% else %>
       <INPUT TYPE="submit" style="border:1px solid #000000; padding-top:2; padding-bottom:1"  NAME=dest VALUE="Advance" onClick="document.forms[0].action='Advance.asp'" >
<% end if %>

Help with this and it's all done!
Avatar of dcass

ASKER

Got it!!!function ActionAfterWait() {
  Stop();
  alert('You may proceed to the next segment now!');
// I added this next line
  document.getElementById('Submit').disabled = false;
}

function Start() {
   clearTimeout(timerID);
   clearTimeout(totTimerID);
   timerID  = 0;
   totTimerID = 0;
   document.theTimer.theTime.value = "30:00";
   totTimerID = setTimeout("ActionAfterWait()", totDuration);
   document.theTimer.theTime.value = "30:00";
   timerID  = setTimeout("UpdateTimer()", 1000);
// and I added this line
   document.getElementById('Submit').disabled = 'disabled';
}

and this:
   <input type=text name="theTime" size=3 readonly>
   <INPUT TYPE="submit" id="submit" style="border:1px solid #000000; padding-top:2; padding-bottom:1"  NAME=dest VALUE="Advance" onClick="document.forms[0].action='Advance.asp'" >
                               
and it works exactly the way I want it to.
Thanks!!!