| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 698 人关注过本帖
标题:高手都进来讨论:如何在“购物车”里加上SIZE和COLOUR
只看楼主 加入收藏
xxcdcd
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-12-26
收藏
 问题点数:0 回复次数:3 
高手都进来讨论:如何在“购物车”里加上SIZE和COLOUR

<table width="760" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td align="center" valign="middle" bgcolor="#E9ECB5"> <TABLE cellSpacing=0 cellPadding=0 width="98%" border="0" style="border-collapse: collapse"> <TR> <TD valign="top">

</td></tr><tr> <td align="center"> <TABLE cellSpacing=0 cellPadding=0 width="98%" border="0" style="border-collapse: collapse"> <TR> <TD> <% size=Request("size")

colour=Request("colour") Sub PutToShopBag( productID,quantity, productList ,quantityList) If Len(productList) = 0 Then productList = "" & productID & "" quantityList="" & quantity & "" ElseIf InStr( productList&",", productID&"," ) <= 0 Then productList = productID & ""& ", " &productList quantityList = quantity & ", " &quantityList

End If session("productList")=productList

session("quantityList")=quantityList End Sub

productList = session("productList") quantityList = session("quantityList") if Request("productID")<>"" then PutToShopBag Request("productID"), "1",productList,quantityList end if session("productList")=productList session("quantityList")=quantityList

Head="YOU SHOPCART LIST"

If Request("clear") = "yes" Then productList = "" quantityList = "" session("productList") = productList session("quantityList") = quantityList End If If Request("MySelf") = "Yes" Then productList = "" quantityList = "" products = Split(Request("productID"), ", ") For I=0 To UBound(products) j=UBound(products)-i tempQuantity=Request("quantity"&products(j)) if tempQuantity="" then tempQuantity=1 ' j=i PutToShopBag products(j), tempQuantity,productList,quantityList Next session("productList") = productList session("quantityList") = quantityList End If 'If Len(productList) = 0 Then ' Response.Redirect "Nothing.asp" ' response.end 'end if %> <script language="Javascript"> //函数名:fucCheckNUM //功能介绍:检查是否为数字 //参数说明:要检查的数字 //返回值:1为是数字,0为不是数字 function fucCheckNUM(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(){ if (confirm("DEL?")==1){ window.location.href="shopCart.asp?clear=yes"} }

function checknum(theform) { //newprice="Q_"&rs("product_Id") if ((fucCheckNUM(theform.value)==0) ) { theform.value=""; //theform.newprice.focus(); return false; } }

function checkNumNull(theform) { if (theform.value=="") { alert("Config Quantity"); //theform.newprice.focus(); theform.focus(); return false; } } //-->

</SCRIPT> <table width="100%" border="0" cellspacing="0"> <form name="form1" Action="shopCart.asp" Method="POST" > <tr> <td width="80%" valign="top" align="center"> <p align="center"><br><br> <font color="#FF0000" class=main1><%=Head%></font></p> <input type="hidden" name="MySelf" value="Yes"> <table border="1" cellpadding="0" cellspacing="0" width="95%" bordercolor="#7B8239" style="border-collapse: collapse" align="center"> <tr bgcolor="#D7DBAC"> <td width="34" height="22" align="center">Buy</td> <td width="29" height="22" align="center">Code</td> <td width="40" height="22" align="center">Photo</td> <td align="center">Name</td> <td width="76" height="22" align="center">Price</td> <td width="77" height="22" align="center">Quantity</td> <td width="73" height="22" align="center">Total</td> </tr> <% Sum = 0 ' response.write session("quantityList")&"quantityList<br>" ' response.write session("productList")&"productList<br>" If Len(productList) <>0 Then ' response.End quantityArray = Split(session("quantityList"), ", ") productArray = Split(session("productList"), ", ") for i=0 to UBound(productArray) set rs=server.createobject("adodb.recordset") sql = "Select * From product where id="&productArray(i) rs.open sql,conn,1,1 if Not rs.EOF or err then quantity = quantityArray(i) ' quantity = cstr(quantityArray(i)) ' response.write quantity&"quantity" ' response.End If quantity <= 0 Then quantity = 1 Sum = Sum + rs("memberPrice") * quantity %> <tr> <td Align="center" width="34"> <input Type="CheckBox" Name="productID" Value="<%=rs("id")%>" Checked> </td> <td align="center" width="29"><%=rs("id")%>  </td> <td align="center" width="40"> <a href="productShow.asp?id=<%=rs("id")%>" title="check it to see more info"> <%if rs("smallImg")="nothing" then %> <img src=images/noSmallImg.gif border=0 height=60><%else%><img src=smallImg/<%=rs("smallImg")%> border=0 height=60><%end if%></a></td> <td align="center"><%=rs("name")%><br> size:<%=size%> <br> colour:<%=colour%></td> <td align="center" width="76"><%=rs("memberPrice")%> </td> <td align="center" width="77"> <input Name="quantity<%=rs("id")%>" Value="<%=quantity%>" Size="4" onKeyUp="checknum(quantity<%=rs("id")%>)"> </td> <td Align="center" width="73">$<%=rs("memberPrice")*quantity%> </td> </tr> <% end if next rs.close conn.close canPay="" else canPay="disabled" end if %> <tr bgcolor="#D6DBAD"> <td Align="Right" ColSpan="7" height="24">Shipping Charge<font Color="Red">Total:&nbsp;$<%=Sum%>&nbsp;<%=Sum+10%><font color="#ABABAB"></font> &nbsp;&nbsp;</font></td> </tr> </table> <blockquote> <p align="center"> <input Type="submit" Value="Upgrade" name="B1" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" <%=canPay%>> &nbsp;&nbsp; <input type="button" value="shopping" name="B2" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" onclick="window.location='<%=session("oldUrl")%>';"> &nbsp;&nbsp; <input type="button" value="cancel" name="B3" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" OnClick="clean()" <%=canPay%>> &nbsp;&nbsp; <input type="button" value="Settlement" name="B4" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" onclick="window.location.href='PayMent.asp';" <%=canPay%>> </blockquote> <font color="#FF0000">Settle account and change the quantity of the goods and reduce the type of merchandize be ues"Upgrade"</font> <br> </td> </tr> </form> </table> </TD> </TR> </TABLE> <table width="700" border="0" cellspacing="0" cellpadding="0" align="center" height="30"> <tr align="center" valign="middle"> <td align="center"> <a href="Javascript:window.history.go(-1)">Back</a> </td> </tr> </table> <table align=center border=0 cellpadding=0 cellspacing=0 width="92%" height="30"> <tr> <td></td> </tr> </table> </td></tr><tr><td> </TD> </TR> </TABLE> </td> </tr> </table>

[此贴子已经被作者于2004-12-26 15:31:59编辑过]

搜索更多相关主题的帖子: 购物车 COLOUR SIZE 
2004-12-26 15:04
silvermoon
Rank: 1
等 级:新手上路
帖 子:188
专家分:0
注 册:2004-8-20
收藏
得分:0 

汗```好长``就只把重点帖出来吧


我是一棵菠菜~~菜菜菜菜菜~~~
2004-12-26 20:05
adf
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-12-27
收藏
得分:0 
dsaf
2004-12-27 11:55
yaoyaochen
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2004-12-27
收藏
得分:0 
不知道他想说明哪一段
2004-12-27 12:54
快速回复:高手都进来讨论:如何在“购物车”里加上SIZE和COLOUR
数据加载中...
 
   



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

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