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

JavaScript gets the row content selected by GridView_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:54:23
Original
1187 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:
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
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template