#12003/7/15 17:38:44
--------------------------------------------------------------------------------
一位前辈曾给过我一段代码如下, 可没有删除购物车中商品的功能,求下文:
*************************************************
购物车:
if trim(request("id"))<>"" then
x=""
stock=request.cookies("sell")("buy")
add=request("id")
If Len(stock) = 0 Then
stock = add&",1|"
else
a=split(stock,"|")
j=ubound(a)
tag=0
for i=0 to j-1
b=split(a(i),",")
if (b(0)=add) then
b(1)=b(1)+1
tag=1
end if
x=x&b(0)&","&b(1)&"|"
next
if tag=1 then
stock=x
else
stock=stock&add&",1|"
end if
End If
response.cookies("sell")("buy")=stock
Response.Cookies("sell").Expires = dateadd("d","1",date())
end if
更改商品数量:
<%
if request("Update")="修改" then
xx=""
stock=""
if request.cookies("sell")("buy")<>"" then
for tt=1 to request("stock_num").count
add=cint(request("stock_num")(tt))
stock=request.cookies("sell")("buy")
ab=split(stock,"|")
bs=split(ab(tt-1),",")
bs(1)=add
xx=xx&bs(0)&","&bs(1)&"|"
next
stock=xx
response.cookies("sell")("buy")=stock
end if
end if%>
**********************************************