document.form1.chk_pid[...].checked为空或不是对象
贴上代码请
hxfly帮我谢谢了
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%=request("pazhid")%>
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from peizhi where xianzhe=1 and pazhid='"&request("pazhid")&"'",conn,1,1
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 数据库中暂时无数据!</p>"
%><%else%><form name="form1" action="" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#71AAD5">
<tr bgcolor="#FFFFFF">
<td>商品类别</td>
<td>商品名称</td>
<td>商品型号</td>
<td>普通价格</td>
<td>会员价格</td>
<td>vip价格</td>
<td>选择我要的配置 </td>
</tr><%
do while not rs.eof%>
<tr bgcolor="#FFFFFF"><td><%=rs("sorts")%></td>
<td><%=rs("name")%></td>
<td><%=rs("type")%></td>
<td><%=rs("price1")%></td>
<td><%=rs("price2")%></td>
<td><%=rs("vipprice")%></td><td>
<input name="chk_pid" type="checkbox" value="<%=rs("id") %>" checked >
</td>
</tr>
<%
rs.movenext
loop%>
<%rs.close
set rs=nothing
end if %></table></form>
<br><form name="form2" action="" method="post">
<%=request("pazhid")%>可选配置
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from peizhi where xianzhe=2 and pazhid='"&request("pazhid")&"'",conn,1,1
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 数据库中暂时无数据!</p>"
%><%else%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#71AAD5">
<tr bgcolor="#FFFFFF">
<td>商品类别</td>
<td>商品名称</td>
<td>商品型号</td>
<td>普通价格</td>
<td>会员价格</td>
<td>vip价格</td><td>选择我要的配置 </td>
</tr><%
do while not rs.eof%>
<tr bgcolor="#FFFFFF">
<td><%=rs("sorts")%></td>
<td><%=rs("name")%></td>
<td><%=rs("type")%></td>
<td><%=rs("price1")%></td>
<td><%=rs("price2")%></td>
<td><%=rs("vipprice")%></td><td><input name="chk_pid2" type="checkbox" value="<%=rs("id") %>"></td>
</tr>
<%
rs.movenext
loop%>
<%rs.close
set rs=nothing
end if %></table></form>
</span>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><a href="javascript:compare();">我自己想要的配置</a></td>
</tr>
</table><SCRIPT language="jscript">
function compare(){
var iCount = 0;
var strQuery = "";
var asaa;
var asaa1;
var asaa2;
asaa1=document.form1.chk_pid.length;
asaa2=document.form2.chk_pid2.length;
asaa=asaa1+asaa2;
document.form2.chk_pid2.length;
for(var i = 0; i < asaa;i++){
if((document.form1.chk_pid[i].checked == true)||(document.form2.chk_pid2[i].checked == true)){
iCount++;
if(iCount>12){
alert("不能选择超过十二个产品进行比较!");
return false;
}
strQuery = strQuery + "id="+document.form1.chk_pid[i].value+"&"+document.form2.chk_pid2[i].value+"&";
}
} if(iCount==0){
alert("请先选择产品进行比较!");
return false;
} if(strQuery!=""){
window.open('bijiao.asp?'+strQuery,'','');
}
}
</script>