Hi, I have a countdown timer in javascript that is called by a code behind using asp.net VB. I cannot find a way to keep track of the time ,.
the problem is., I cannot get the time that elapsed after postback so that the timer would continue ticking,. can you help me please,.?? I would really appreciate it.,
here is my code fragment:
asp.net VB codebehid
    on page load{
        If Page.IsPostBack = True Then
            ClientScript.RegisterClientScriptBlock(Me.GetType, "timer_script",
           "<script language='javascript'>function mySubmit()</script>")
            ClientScript.RegisterStartupScript(Me.GetType, "timer_script", 
            "<script>countdown_clock();</script>")
        End If
        If Page.IsPostBack = false Then
            TimerTxtbx.Text = "00:06:10"   'hour:min:sec -> initialize timer
            ClientScript.RegisterClientScriptBlock(Me.GetType, "timer_script",
           "<script language='javascript'>function mySubmit()</script>")
            ClientScript.RegisterStartupScript(Me.GetType, "timer_script", 
            "<script>countdown_clock();</script>")
        End If
    }
    on button click{
        NextBtn.Attributes.Add("onclick", "mySubmit()")   'call a javascript function
        ClientScript.RegisterStartupScript(Me.GetType, "timer_script", 
        "<script>countdown_clock();</script>")
    }
javascript code:
function mySubmit()
{
 document.getElementById('TimerTxtbx').removeAttribute('disabled');
}
    function countdown_clock()
{     
    var current_time;
 current_time = document.getElementById('TimerTxtbx').value;
 var hours = current_time.substring(0,2);
 var minutes = current_time.substring(3,5);
 var seconds = current_time.substring(6,8); 
 var n_seconds;
 var n_minutes = minutes;
 var n_hours = hours;
 if (seconds == 0)
 {
    n_seconds = 59;
    if (minutes == 0)
  {
  n_minutes = 59;
   if (hours == 0){
   alert('Time is up');
   return;
   }
          else{ 
          n_hours = hours - 1;
      if (n_hours < 10)
             n_hours = "0" + n_hours;
          }
         }
  else
  {
   n_minutes = minutes - 1;
   if (n_minutes < 10)
    n_minutes = "0" + n_minutes;
  }
 }
 else
 {
     n_seconds = seconds - 1;
  if (n_seconds < 10)
   n_seconds = "0" + n_seconds;
 }
      document.getElementById('TimerTxtbx').value = n_hours + ':' + n_minutes + ':' + n_seconds;
      setTimeout("countdown_clock()",1000); //function call and delay by 1sec
      document.getElementById('TimerTxtbx').setAttribute('disabled','disabled');
      }//end function