国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
ASP購物車代碼超級簡單

將以下ASP購物車代碼都保存為一個文件,如cart.asp,調用時比如加入購物車直接使用鏈接cart.asp?id=商品ID即可。本例中商品數據庫表為product,使用到商品ID,商品名稱product_name等,在實際使用ASP購物車代碼時將相關參數替換下。
<%'簡單ASP購物車代碼原理
action=request.QueryString("action")
if request.QueryString("id")="" then
bookid=session("productlist")'//////////////////////////////////調入查詢物品的id
else
  if session("productlist")="" then
session("productlist")=request.QueryString("id")
bookid=request.QueryString("id")
  else
    if instr(request.querystring("id"),session("productlist"))<1 then
bookid=session("productlist")+","+request.QueryString("id")'//////////////把id全部存儲到bookid中類似與數組
session("productlist")=bookid
    else
bookid=session("productlist")
    end if
  end if
end if

if session("productlist")="" then'////////////////////////若id為空,則說明用戶沒有購物
bookid=0
end if

if action="del" then '刪除購物車中的某一件商品
aProducts=split(Session("ProductList"),",")
delid=cstr(trim(Request.QueryString("id")))
For i=0 To UBound(aProducts)    '循環(huán)所有商品ID
    If trim(aProducts(i))<>delid then
        '不等于被刪除的ID時則保存進新的列表中
        sNewProducts = sNewProducts & "," & aProducts(i)
    end if
Next
Session("ProductList") = mid(sNewProducts,2)
  if session("ProductList")="" then
bookid=0
  else
bookid=Session("ProductList")
  end if
end if
%>

以下是ASP購物車里的所有商品:<br><br>
<%'根據臨時存儲到SESSION里的商品ID分別從商品數據庫循環(huán)調出商品顯示到購物車頁面,遇到重復ID不顯示
if bookid<>0 and bookid<>"" then
set rs=server.CreateObject("adodb.recordset")
dim sql
sql="select id,product_name from product where id in ("&bookid&") order by id" '這里替換成實際的商品數據庫及字段
rs.open sql,conn,1,1
   dim bookscount,books '定義判斷有幾個bookid
   bookscount=request.QueryString("id").count
   aa=1
   do while not rs.eof
   dim quatity '判斷input 名
Quatity = CInt( Request( "ckxp"&rs("id")) )
If Quatity <=0 Then Quatity = 1
'以下為購物車每一件商品內容,包含ID、名稱、數量及取消
%>

商品ID:<%=rs("id")%>
商品名稱:<a href="showproduct.asp?id=<%=rs("id")%>" title="<%=rs("info")%>" target="_blank"><%=rs("product_name")%></a>
訂購數量:<input name="sl<%=aa%>" type="text" Value="1" size="3">
取消商品:<a href="?nav=m&id=<%=rs("id")%>&action=del"><font color="#FF0000" size="4" style="font-weight:bold">×</font></a>
<br>

<%'循環(huán)讀取ASP購物車內的商品
rs.movenext
aa=aa+1
loop
rs.close
set rs=nothing
%>
<%if bookid=0 or bookid="" then%>ASP購物車內沒有商品,請選擇需訂購的商品。<%end if%>

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
學習目的:基本的SESSION組件,總結response,request組件
Asp連接access添加,刪除,修改2
用ASP開發(fā)一個在線考試系統
ASP.NET購物車(源碼下載)
購物車程序的規(guī)劃
ASP.NET內置對象
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服