📄 cartbase.asp
字号:
<%
'================================================ =
'过程名:PutToCart
'作 用:显示购物车数据手机数据(无修饰)
'参 数:
' productID:放入购物车的商品编号
' quantity,:放入商品数量
'================================================ =
Sub PutToCart( productID,quantity)
dim productList, quantityList
'放到本地变量中,以期提高效率
productList = Session("productList")
quantityList = Session("quantityList")
If Len(productList) = 0 Then
Session("productList") = productID
Session("quantityList") = quantity
ElseIf InStr( productList & ",", productID & "," ) <= 0 Then
Session("productList") = productID & ", " & productList
Session("quantityList") = quantity & ", " & quantityList
End If
End Sub
'================================================ =
'过程名:ShowCartTable
'作 用:显示购物车数据手机数据(无修饰)
'参 数:无
'================================================ =
sub ShowCart()
dim canPay
%>
<table width = "100%" border = "0" cellspacing = "0" ID = "Table1">
<TR>
<TD class = "tabTitle" height = "22" bgColor=<%=conTitleColor%>><b>购物清单</b></TD></TR>
<TR>
<tr>
<td width = "80%" valign = "top"><p align = "center">
<font color = "#FF0000" class = main1><%=Head%></font>
<form name = "form1" Action = "shopCart.asp" Method = "POST" ID = "Form1">
<input type = "hidden" name = "Modify" value = "Yes" ID = "Hidden1">
<div align = "center">
<%
canPay = ShowCartTable()
%>
<blockquote>
<p align = "center">
<input Type = "submit" Value = "确认更改" name = "B1" style = "border:1px solid #7D85A2; font-size: 9pt; background-color:rgb(210,232,255)" <%=canPay%> ID = "Submit1">
<input type = "button" value = "继续购物" name = "B2" style = "border:1px solid #7D85A2; font-size: 9pt; background-color:rgb(210,232,255)" onclick = "window.location = '<%=Session("oldUrl")%>';" style = "font-size: 9pt" ID = "Button1">
<input type = "button" value = "订单取消" name = "B3" style = "border:1px solid #7D85A2; font-size: 9pt; background-color:rgb(210,232,255)" OnClick = "clean()" style = "font-size: 9pt" <%=canPay%> ID = "Button2">
<input type = "button" value = "去收银台" name = "B4" style = "border:1px solid #7D85A2; font-size: 9pt; background-color:rgb(210,232,255)" onclick = "window.location.href = 'payStep1.asp';" style = "font-size: 9pt" <%=canPay%> ID = "Button3">
</blockquote>
<div align = "center"><font color = "#FF0000">注意:改变手机数量和减少手机种类需按“确认更改”按钮</font>
<br>
</form>
</td>
</tr>
</table>
<%
end sub
'================================================ =
'过程名:ShowCartTable
'作 用:显示购物车数据手机数据(无修饰)
'参 数:无
'================================================ =
function ShowCartTable()
dim Sum, canPay
dim quantityArray, productArray, quantity, i
dim strSQL, rsObj
%>
<table border = "1" cellpadding = "0" cellspacing = "0" width = "95%" bgcolor = "#FFFFFF" bordercolor = "#808080" style = "border-collapse: collapse">
<tr bgcolor = "rgb(210,232,255)">
<td align = "center" width = "34" height = "22" >购买</td>
<td align = "center" width = "59" height = "22" >手机编号</td>
<td align = "center" width = "191" height = "22" >手机名称</td>
<td align = "center" width = "76" height = "22" >手机价格</td>
<td align = "center" width = "77" height = "22" >手机数量</td>
<td align = "center" width = "73" height = "22" >总价</td>
</tr>
<%
Sum = 0
If Len(Session("productList")) <>0 Then
quantityArray = Split(Session("quantityList"), ", ")
productArray = Split(Session("productList"), ", ")
for i = 0 to UBound(productArray)
strSQL = "SELECT * FROM product WHERE id = "&productArray(i)
set rsObj = conn.execute (strSQL)
if Not rsObj.EOF or err then
quantity = quantityArray(i)
If quantity <= 0 Then quantity = 1
Sum = Sum + rsObj("memberPrice") * quantity
%>
<tr>
<td Align = "center" width = "34">
<input Type = "CheckBox" Name = "productID" Value = "<%=rsObj("id")%>" Checked ID = "Checkbox1">
</td>
<td align = "center" width = "59"><%=rsObj("id")%> </td>
<td align = "center" width = "191"><%=rsObj("name")%> </td>
<td align = "center" width = "76"><%=rsObj("memberPrice")%> </td>
<td align = "center" width = "77">
<input Name = "quantity<%=rsObj("id")%>" Value = "<%=quantity%>" Size = "4" onKeyUp = "checknum(quantity<%=rsObj("id")%>)" ID = "Text1">
</td>
<td Align = "center" width = "73"><%=rsObj("memberPrice")*quantity%>元
</td>
</tr>
<%
end if
set rsObj = nothing
next
canPay = ""
else
canPay = "disabled"
end if
%>
<tr>
<td Align = "Right" ColSpan = "6" width = "520" height = "24"><font Color = "Red">总价格: <%=Sum%> 元<font color = "#ABABAB">人民币</font>
</font></td>
</tr>
</table>
<%
'返回价格总数,以标识购物车内是否有手机
ShowCartTable = canPay
end function
%>
<Script language=javascript>
function clean(){
if (confirm("确定要清空购物车?") == 1){
window.location.href = "shopCart.asp?clear=yes"}
}
function checkNumNull(theform) {
if (theform.value == "") {
alert("请填写购买手机的数量");
//theform.newprice.focus();
theform.focus();
return false;
}
}
</Script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -