| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 517 人关注过本帖
标题:[求助]asp 购物车更改数量的问题
只看楼主 加入收藏
可见光
Rank: 1
等 级:新手上路
帖 子:143
专家分:0
注 册:2007-6-15
收藏
 问题点数:0 回复次数:0 
[求助]asp 购物车更改数量的问题

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="conn.asp"--->
<!--#include file="util.asp"--->
<%
strCpbm=request("cpbm")
ProductList=session("ProductList")
Products=Split(request("cpbm"),",")
for I=0 to UBound(Products)
PutToShopBag Products(I),ProductList
Next
session("ProductList")=ProductList
Head="以下是你所选购的CD"
ProductList=session("ProductList")
if len(ProductList)=0 then
response.redirect"nothing.asp"
response.End
end if
if request("MySelf")="Yes" then
ProductList=""
Products=split(request("cpbm"),",")
for I=0 to UBound(Products)
PutToShopBag Products(I),ProductList
Next
session("ProductList")=ProductList
end if
if len(ProductList)=0 then
response.redirect"nothing.asp"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
sql="Select * From product"
sql=sql & " Where Product_Id In("& ProductList&")"
rs.open sql,conn,3,3
set rs=conn.Execute(sql)

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>以下是你多选购的CD</title>
<style type="text/css">
<!--
.style2 {color: #333333}
-->
</style>
</head>
<script language="javascript">
function funCheckNUM(NUM)
{ var i,j,strTemp;
strTemp="0123456789"
if (NUM.length==0)
return 0
for(i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if(j==-1)
{
return 0;
}
}
return 1;
}
function clean()
{
window.location.href="clear.asp"
}
</script>
<script language=javascript >
<!--
function form1_onsubmit()
{ newprice="Q_"&rs("Product_Id")
if((funCheckNUM(document.FORM1.newprice.value)==0))
{
alert("会员价有非法字符,请填写正确的会员价!@");
document.FORM1.newprice.focus();
return false;
}
//-->
}

</script>
<body topmargin="5">
<center>
<div align="center">
<center>
<table width="80%" border="0" cellpadding="0">
<tr>
<td width="80%" valign="top"><p align="center"></p>
<p align="center"><font color="#666666"><%=Head%></font></p>
<!--Webbot BOT="GeneraredScript" PREVIEW="" startspan-->
<script language="javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
var checkOK="0123456789-";
var checkStr=theForm.<%="Q_"&rs("Product_Id")%>.value;
var allValid=true;
var decPoints=0
var allNum=""
for(i=0;i<checkStr.length;i++)
{ ch=checkStr.charAt(i);
for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;
if(j==checkOK.length)
{ allValid=false;
break;
}
allNum+=ch;
}
if(!allValid)
{
alert("请输入正确的商品数量!(1~4个字符)");
theForm.<%="Q_"&rs("Product_Id")%>.focus();
return(false);
}
return(true);
}
//-->
</script>
<!--Webbot BOT="GeneraredScript" PREVIEW="" endspan-->
<form action="eshop.asp" method="post" onSubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="0" cellspacing="1" width="550" class="main" bgcolor="#CCCCCC">
<tr bgcolor="#CCCCFF"></tr>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style2">CD编号</span></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">CD名称</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">CD价格</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">数量</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">购买</font></td>
<td align="center" width="82" height="22" bgcolor="#CCFFFF"><span class="style1">总价</font></td>
</tr>
<%
Sum=0
While Not rs.EOF
Quatity=cint(request("Q_"&rs("Product_Id"))) '我用SQL语句输出是这个地方的问题,
'有问题,可我不知道怎么改好
if Quatity<=0 then              
Quatity=cint(session(rs("Product_Id")))
if Quatity<=0 then Quatity=1
end if
session(rs("Product_Id"))=Quatity
Sum=Sum+ccur(rs("P_Newprice"))*Quatity
%>

<tr>
<td align="center" width="82" bgcolor="#eeeeee"><%=rs("Product_Id")%></td>
<td align="center" width="170" bgcolor="#eeeeee"><%=rs("Product_Name")%></td>
<td align="center" width="72" bgcolor="#eeeeee"><%=rs("P_Newprice")%></td>
<td align="center" width="76" bgcolor="#eeeeee" ><!--Webbot
bot="Validation" S-Display-Name="请输入正确的CD数量!" S-Data-Type="Integer" S-Number_Separators="x"
--><input name="<%="Q_" &rs("Product_Id")%>" value="<%=Quatity%>" size="3">
</td>
<td align="center" width="60" bgcolor="#EEEEEE"><input type="checkbox" name="cpbm" value="<%=rs("Product_Id")%>"Checked>
</td>
<td align="center" width="72" bgcolor="#eeeeee"><%=ccur(rs("P_Newprice"))*Quatity%>.00元</td>
</tr>
<%
rs.moveNext
Wend
%>
<tr>
<td align="right" colspan="6" width="546" bgcolor="#EEEEEE"><font color="#FF0000">总价格=人民币<%=Sum%>.00元</font></td>
</tr>
</table></center></div>
<blockquote><p align="center">
<input type="submit" value="更改数量" name="B1" style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="继续购物" name="B2" onClick="window.close();"style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="订单取消" name="B3" onClick="clean()" style="font-size:13px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="去收银台" onClick="window.open('ment.asp',window.close(),'Sample','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scollbars=yes,resizable=yes,copyhistory=yes,width=610,height=600,left=100,top=100')" name="B4"style="font-size:13px">
<p align="center"><font color="#FF0000">注意:更改CD数量需要按“更改数量”</font></p>
</p></blockquote></form>

</td></tr>
</table>
</center>
</div>
<% rs.close
conn.close
%>
</body>
</html>



现在选购一件商品的时候可以更改数量,当选购多件后,一点更改数量,默认就只显示一件商品的信息,后面的就没了

搜索更多相关主题的帖子: 购物车 asp 数量 
2007-10-13 23:13
快速回复:[求助]asp 购物车更改数量的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017139 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved