javascript for asp.net listview item template

sam

New Member
i am trying to implement timer for my listview items.my javascript is as follow:\[code\]function countdown() {var now = new Date();var biddate = document.getElementById('InitiateDate').valuevar 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<10) { mm = "0" + mm;}if (ss<10) { ss = "0" + ss;}document.getElementById("CountDownTimer") .innerHTML = dd + ':' + hh + ':' + mm + ':' + ss;if (dd < 0) { document.getElementById("CountDownTimer") .innerHTML = "time up";}}setInterval('countdown()', 1000);\[/code\]and my listview item template relevant part is:\[code\] <td> <asp:TextBox ID="InitiateDate" runat="server" Text='<%# Eval("InitiateDate") %>' ReadOnly="True" ClientIDMode="Static"></asp:TextBox> <div id="CountDownTimer" class="timer"> </div> </td>\[/code\]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.
 
Back
Top