组织表格的时候,可以给每行加一个行标识,如下:
<%
index=0;
while(循环所有的新生)
{
%>
<tr>
<td><input name="line<%=index%>_bh"></td>
<td><input name="line<%=index%>_xm"></td>
<td><input name="line<%=index%>_xb"></td>
<td><select name="line<%=index%>_bj"></td>
</tr>
<%
index++;
}
%>
//然后记住最大的index,如下:
<input type="hidden" value=<%=index%> name="maxindex">
//在提交表单的处理时,这样获得一行的数据:
for(int i=0;i<=index;i++){
String bh=request.getParameter("line"+i+"_bh");
String xm=request.getParameter("line"+i+"_xm");
String xb=request.getParameter("line"+i+"_xb");
String bj=request.getParameter("line"+i+"_bj");}
<%
index=0;
while(循环所有的新生)
{
%>
<tr>
<td><input name="line<%=index%>_bh"></td>
<td><input name="line<%=index%>_xm"></td>
<td><input name="line<%=index%>_xb"></td>
<td><select name="line<%=index%>_bj"></td>
</tr>
<%
index++;
}
%>
//然后记住最大的index,如下:
<input type="hidden" value=<%=index%> name="maxindex">
//在提交表单的处理时,这样获得一行的数据:
for(int i=0;i<=index;i++){
String bh=request.getParameter("line"+i+"_bh");
String xm=request.getParameter("line"+i+"_xm");
String xb=request.getParameter("line"+i+"_xb");
String bj=request.getParameter("line"+i+"_bj");}
<tr>
<td>a</td>
<td>b</td>
</tr>
<tr>
<td>c</td>
<td>c</td>
</tr>
<table>
-----------------------------------
如上表,第二行第一列的值是document.all.tbl.rows(1).cells(0).innerText
<HEAD>
<TITLE></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD><BODY>
<table width="668" height="258" border=1 id="test">
<tr>
<td>111</td>
<td>222</td>
<td>333</td></tr>
<tr>
<td>444</td>
<td>555</td>
<td>666</td></tr>
<tr>
<td>777</td>
<td>888</td>
<td>999</td></tr>
</table>
<script>
alert(test.rows[1].cells[0].innerHTML)
</script>
</BODY>
</HTML>