Home  >  Article  >  Web Front-end  >  JavaScript gets the row content selected by GridView_javascript skills

JavaScript gets the row content selected by GridView_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:54:231098browse

To select these things, you must first find out which row is selected, as follows:
var table = document.getElementById("");
var rowIndex = 0;
for(var i =1;i

{
var input = table.rows[i].cells[0].getElementsByTagName("input")[0].checked;
if (input == true)
{
rowIndex = i;
return rowIndex;
}
}
Get the value in TextBox
table.rows[rowIndex] .cells[3].getElementsByTagName("input")[0].value
Get the value in Lable
table.rows[rowIndex].cells[4].getElementsByTagName("span")[0] The .innerHTML after .innerHTML
can be replaced with .innerText, but .innerHTML has better browser compatibility.
(Please note here: whether you use .innerHTML or .innerText, the information will only be displayed between XXXX, instead of being displayed in like TextBox labels. Disadvantages Yes: It will disappear as soon as the page is refreshed.)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn