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

js implements traversing table instances containing input_javascript skills

WBOY
Release: 2016-05-16 15:27:24
Original
1504 people have browsed it

The example in this article describes the js implementation of traversing a table containing input. Share it with everyone for your reference, the details are as follows:

table is as follows:

<table id="groupTable" class="tblist_black">
<%
 DataTable firstGroupTable = ViewState["firstGroupTable"] as DataTable;
 if (firstGroupTable != null)
 {
 for (int i = 0; i < firstGroupTable.Rows.Count; i )
 {
 %>
  <tr>
  <td><div style="width:40px;"><span>一级</span></div></td>
  <td><div style="width:40px;"><span> </span></div></td>
  <td><div style="width:180px;"><span><input type="text" value="<%=firstGroupTable.Rows[i]["GroupName"]%>" /></span></div></td>
  <td style="display:none"><div style="width:80px;"><span><%=firstGroupTable.Rows[i]["FirstNodeID"]%></span></div></td>
  <td style="display:none"><div style="width:80px;"><span> </span></div></td>
  <td><div style="width:60px;"><span><a href="#" onclick="editRow(<%=i%>)">[更新]</a></span></div></td>
  <td><div style="width:60px;"><span><a href="">[删除]</a></span></div></td>
  <td><div style="width:60px;"><span><a href="">[二级]</a></span></div></td>
  </tr>
<%
 }
 }
%>
</table>
Copy after login

js is as follows:

function editRow(rowIndex) {
 alert(window.groupTable.rows.item(rowIndex).cells.item(2).getElementsByTagName_r('input')[0].value);
}
Copy after login

I hope this article will be helpful to everyone in JavaScript programming.

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