title: javascript for asp.net listview item template
body: <p>i am trying to implement timer for my listview items.
  my javascript is as follow:</p>
  
  <pre><code>function countdown() {
  var now = new Date();
  var biddate = document.getElementById('InitiateDate').value
  var kickoff = Date.parse(biddate);
  var diff = kickoff - now;
  
  var days = Math.floor(diff / (1000 * 60 * 60 * 24));
  var hours = Math.floor(diff / (1000 * 60 * 60));
  var mins = Math.floor(diff / (1000 * 60));
  var secs = Math.floor(diff / 1000);
  
  var dd = days;
  var hh = hours - days * 24;
  var mm = mins - hours * 60;
  var ss = secs - mins * 60;
  
  if (mm&lt;10) {
      mm = "0" + mm;
  }
  if (ss&lt;10) {
      ss = "0" + ss;
  }
  
  
  document.getElementById("CountDownTimer")
              .innerHTML =
                  dd + ':' +
                  hh + ':' +
                  mm + ':' +
                  ss;
  
  if (dd &lt; 0) {
      document.getElementById("CountDownTimer")
              .innerHTML = "time up";
  }
  
  }
  setInterval('countdown()', 1000);
  </code></pre>
  
  <p>and my listview item template relevant part is:</p>
  
  <pre><code>    &lt;td&gt;
      &lt;asp:TextBox ID="InitiateDate" runat="server" Text='&lt;%#  Eval("InitiateDate") %&gt;'  ReadOnly="True"  ClientIDMode="Static"&gt;&lt;/asp:TextBox&gt;
      &lt;div id="CountDownTimer" class="timer"&gt; &lt;/div&gt;
      &lt;/td&gt;
  </code></pre>
  
  <p>this javascript is working fine but only for the first row of the listview.i need it to work for all rows and will give the the countdown timer for each row.</p>