<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: $<%=Sum%> <%=Sum+10%><font color="#ABABAB"></font> </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%>> <input type="button" value="shopping" name="B2" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" onclick="window.location='<%=session("oldUrl")%>';"> <input type="button" value="cancel" name="B3" style="border:1px solid #7D85A2; font-size: 9pt; background-color:#CCCCCC" OnClick="clean()" <%=canPay%>> <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编辑过]