Pass input type = text and span from asp.net listview

jblover7

New Member
I have an asp.net listview with a column that contains, 2 input type = button (id=Start, id=Stop, 1 input type = text (id=TimeMInutes) and 1 span(id=spCountDown).The HTML rendered from all these controls including the listview is...\[code\] <table id="ctl00_ContentPlaceHolder1_lstViewFormulas_itemPlaceholderContainer" style="vertical-align:top; border:solid 1px gray"> <tr id="ctl00_ContentPlaceHolder1_lstViewFormulas_Tr1" style="vertical-align:top; border:solid 1px gray"> <td class="ListViewHeader" style="width:20%"> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblFormName">Step Name</span></td> <td class="ListViewHeader" style="width:10%" align="center"> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblTiming">Timing</span></td> <td class="ListViewHeader" style="width:30%"> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_Label6">Area Used</span></td> <td class="ListViewHeader" style="width:10%"> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblClock">Timer</span></td> <td class="ListViewHeader" style="width:30%"> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_lblProd">Products</span></td> </tr> <tr style=""> <td> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblFormName">Step 1</span> </td> <td> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblTiming">20</span> </td> <td> <span id="ctl00_ContentPlaceHolder1_lstViewFormulas_ctrl0_lblAreaUsed">Scalp</span> </td> <td> <input type="button" onclick="countdown(document.getElementById('TimeMinutes'), document.getElementById('spCountDown'))"; value="http://stackoverflow.com/questions/14485004/Start" id="Start" /> <input type="button" onclick='stopcountdown()'; value="http://stackoverflow.com/questions/14485004/Stop" id="Stop" /> <input type="text" value='http://stackoverflow.com/questions/14485004/20' id="TimeMinutes" /> <span id="spCountDown"></span> </td>\[/code\]I am trying to pass the "TimeMinutes" input type = "text" and the "spCountDown" Span into a javascript function.I have tried several ways, including...\[code\]<input type="button" onclick="countdown(document.getElementById('TimeMinutes'), document.getElementById('spCountDown'))"; value="http://stackoverflow.com/questions/14485004/Start" id="Start" />\[/code\]I have also tried to find these controls within the javascript function using the input id, but I don't get the right row.I need to take the value from the input type = text and in the javascript function start a countdown.\[code\] var interval; var seconds=0; function countdown(txtminutes, spanid) { interval = setInterval(function () { var sp = document.getElementById("spanid"); var minutes = document.getElementById("txtminutes").value if (seconds == 0) { if (minutes == 0) { sp.innerHTML = "countdown's over!"; clearInterval(interval); return; } else { minutes--; seconds = 60; } } if (minutes > 0) { var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute'); } else { var minute_text = ''; } var second_text = seconds > 1 ? 'seconds' : 'second'; sp.innerHTML = minute_text + ' ' + seconds + ' ' + second_text + ' remaining'; seconds--; }, 1000); } function stopcountdown() { window.clearInterval(interval); var sp = document.getElementById("CountDown"); sp.innerHTML = '' }\[/code\]How can I pass in these controls so I can get and set the right value from the right row?Thanks
 
Back
Top