<SCRIPT language=javascript>
function unselectall()
{
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll"&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
</SCRIPT>
<%set rs=conn.execute ("select id,名称,规格 from 表1 order by id")
if not rs.eof then
%>
<form name="myform" method="Post" action="接收并保存选择的数据文件.asp">
<table>
<tr class="title" height="22">
<td height="22" width="30" align="center"><strong>选中</strong></td>
<td height="22" width="30" align="center"><strong>名称</strong></td>
<td height="22" width="30" align="center"><strong>规格</strong></td>
</tr>
<%
i=0
do while not rs.eof
%>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td width="30" align="center"><input name='ID' type='checkbox' onclick="unselectall()" id="ID" value='<%=rs("ID")%>'></td>
<td width="25" align="center"><%=rs("名称")%></td>
<td width="25" align="center"><%=rs("规格")%></td>
</tr>
<%rs.movenext
loop
rs.close:set rs=nothing
%>
</table>
<br>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="tdbg" align=center>
<tr>
<td width="250" height="30"> <input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
选中本页显示的所有 <input name="save" type="submit" value="保存"></td>
</tr>
</table>
</form>
这样就传递了所有所选ID的 数组 (id1,id2,id3,...idN)
接收的时候split (id,",")然后循环保存到数据库就好了 ..