哇,谢谢大哥!我也下班了,回家看了!再次感谢!!!
学无止境!!!
大侠,你给我的代码还是有问题!!!再麻烦帮忙看看,谢谢拉!
111.asp:
<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>
<!--#include virtual="/jinlu/conn.asp"-->
<%set rs=conn.execute ("select a1,a2,a3 from a order by a1")
if not rs.eof then
%>
<form name="myform" method="Post" action="../../222.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='a1' type='checkbox' onclick="unselectall()" id="a1" value='<%=rs("a1")%>'></td>
<td width="25" align="center"><%=rs("a2")%></td>
<td width="25" align="center"><%=rs("a3")%></td>
</tr>
<%rs.movenext
loop
rs.close:set rs=nothing
end if
%>
</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>
----------------------------------------------------------------------------------------------------
222.asp:
<!--#include virtual="/jinlu/conn.asp"-->
<%
a1=request.form("a1")
a2=request.form("a2")
a3=request.form("a3")
aa1=split(a1,",")
aa2=split(a2,",")
aa3=split(a3,",")
Response.Write("返回值是否为数组:"&IsArray(aa1)&"<br>")
For i=LBound(aa1) To UBound(aa1)
exec="insert into b(b1,b2,b3)values('"+aa1(i)+"','"+aa2(i)+"','"+aa3(i)+"')"
conn.execute exec
Next
conn.close
set conn=nothing
%>
------------------------------------------------------------------------------------------------------
如果:
表a:
a1 a2 a3
1 11 111
2 22 222
3 33 333
4 44 444
5 55 555
表b:
b1 b2 b3
空
-------------------------------------------------------------------------------------------------------
问题是:
1:如果选择了3.4两条记录准备插入表b,但实际插入表b的是1.2两条记录=.=!插入的数量是对的,但是具体内容却永远是按照次序排下来的!!!
2:每次插入多条记录的时候,从第二条记录开始每个值前面都加了个空格=.=!比如插入1.2.3三条记录,但插入表b的结果是
1 11 111
_2 _22 _222
-3 _33 _333
第二条记录开始就这样.........=.=!
-------------------------------------------------------------------------------------------------------
在线等待.....大侠请多指教!!!多谢了!!!
[此贴子已经被作者于2007-8-21 12:55:06编辑过]