Home > Web Front-end > JS Tutorial > body text

JavaScript gets the row content selected by GridView_javascript skills

WBOY
Release: 2016-05-16 18:54:23
Original
1138 people have browsed it

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.)
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template