帮忙翻译asp购物车相关代码!

下面是购物车功能相关代码:请高手帮忙翻译下,对这段代码做下说明和注解Basket.asp<%SubPutToShopBag(hw_ID,basket_count,prod... 下面是购物车功能相关代码:请高手帮忙翻译下,对这段代码做下说明和注解
Basket.asp
<%
Sub PutToShopBag( hw_ID,basket_count, productList ,quantityList)
If Len(productList) = 0 Then
productList = "" & hw_ID & ""
quantityList="" & basket_count & ""
ElseIf InStr( productList&",", hw_ID&"," ) <= 0 Then
productList = hw_ID & ""& ", " &productList
quantityList = basket_count & ", " &quantityList
End If
session("productList")=productList
session("quantityList")=quantityList
End Sub
Sub PutToShopBagsecond( hw_ID,basket_count, productList ,quantityList)
If Len(productList) = 0 Then
productList = "" & hw_ID & ""
quantityList="" & basket_count & ""
ElseIf InStr( productList&",", hw_ID&"," ) <= 0 Then
productList = hw_ID & ""& ", " &productList
quantityList = basket_count & ", " &quantityList
End If
session("productList")=productList
session("quantityList")=quantityList
End Sub

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

Head="以下是您所选购的物品清单"

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("hwID"), ", ")
For I=0 To UBound(products)
j=UBound(products)-i
tempQuantity=Request("basket_count"&products(j))
if tempQuantity="" then tempQuantity=1
' j=i
PutToShopBagsecond products(j), tempQuantity,productList,quantityList
Next
session("productList") = productList
session("quantityList") = quantityList
End If

拜托了~~~~
展开
 我来答
百度网友e94bb46
2009-03-27 · TA获得超过616个赞
知道小有建树答主
回答量:821
采纳率:0%
帮助的人:734万
展开全部
Sub PutToShopBag( hw_ID,basket_count, productList ,quantityList) '定义函数PutToShopBag()并传入接受4个参数值分别安顺序赋值给4个变量hw_ID,basket_count, productList ,quantityList
If Len(productList) = 0 Then ’如果productList变量的长度为0 条件成立则执行如下语句
productList = "" & hw_ID & "" ‘productList的值就等于hw_ID变量的值
quantityList="" & basket_count & "" ’quantityList变量的值就为basket_count变量的值
ElseIf InStr( productList&",", hw_ID&"," ) <= 0 Then '否则 判断productList的值连接上字符","后是否包含hw_ID变量连接上字符","的值 <=0表示不包含 条件成立则执行如下语句
productList = hw_ID & ""& ", " &productList '为hw_ID变量连接上字符", "在连接上productList变量的值后赋值给productList变量
quantityList = basket_count & ", " &quantityList '同上
End If '结束条件选择语句if
session("productList")=productList '定义名为productList的session变量 值为productList变量的值
session("quantityList")=quantityList '同上
End Sub
Sub PutToShopBagsecond( hw_ID,basket_count, productList ,quantityList)
If Len(productList) = 0 Then
productList = "" & hw_ID & ""
quantityList="" & basket_count & ""
ElseIf InStr( productList&",", hw_ID&"," ) <= 0 Then
productList = hw_ID & ""& ", " &productList
quantityList = basket_count & ", " &quantityList
End If
session("productList")=productList
session("quantityList")=quantityList
End Sub

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

Head="以下是您所选购的物品清单" '为Head变量赋值

If Request("clear") = "yes" Then '如果上一页传递过来的参数clear的值yes
productList = "" 'productList 变量的值为空
quantityList = "" '同上
session("productList") = productList'同上
session("quantityList") = quantityList '同上
End If
If Request("MySelf") = "Yes" Then
productList = ""
quantityList = ""
products = Split(Request("hwID"), ", ") '把 上一页传递过来的参数hwID的值以", "为分隔符 用split函数遍历为数组赋值给products
For I=0 To UBound(products) ' for 循环 Ubound(products)获取products数组的最大下标
j=UBound(products)-i 'products的最大下表减去i的值赋值给j变量 (下面应该是按照倒叙取值)
tempQuantity=Request("basket_count"&products(j)) '获取同名的basket_count参数的第j+1个的值并复制给tempQuantity
if tempQuantity="" then tempQuantity=1 '如果tempQuantity的值为空则重新为tempQuantity变量赋值为1
' j=i
PutToShopBagsecond products(j), tempQuantity,productList,quantityList '函数中调用函数puToShopBagsecond 并传递4个参数products(j), tempQuantity,productList,quantityList(这句我也不太清楚调用函数应该是call 函数名(参数))
Next
session("productList") = productList ‘赋值语句
session("quantityList") = quantityList ‘赋值语句
End If
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式