当前位置:编程学习 > asp >>

这个是我以前用去年用ASP写的一个购物车主体,已经功过测试,运行良好,希望能给ASP的爱好者带来益处

<%@ Language=VBScript %>
<%Response.Expires=0%>
<%
'写入COOKIE
'Response.Write Request.Cookies("warebuycount")
sub setcookie(Aname,warenum,warename,price,warecount,pricelow)
    Response.Cookies(Aname).domain=application("wareurl") 'wareurl代表域名
    Response.Cookies(Aname).expires=date()+30 'COOKIE过期日期
    Response.Cookies(Aname).path="/"
    Response.Cookies(Aname).Secure = FALSE
    Response.Cookies(Aname)("warenum")=warenum '商品编号
    Response.Cookies(Aname)("warename")=warename '商品名称
    Response.Cookies(Aname)("price")=price '价格
    Response.Cookies(Aname)("warecount")=warecount '购买的数量
    Response.Cookies(Aname)("pricelow")=pricelow '会员价格
end sub
sub setcount(warebuycount) '用于计算客户购买的商品种类
    Response.Cookies("warebuycount").domain=application("wareurl")
    Response.Cookies("warebuycount").expires=date()+30
    Response.Cookies("warebuycount").path="/"
    Response.Cookies("warebuycount").secure=false
    Response.Cookies("warebuycount")=warebuycount
end sub
'写入COOKIES
sub setcookies(warenum,warename,price,warecount,pricelow,warebuycount)
    setcookie "warenum"+Cstr(warebuycount),warenum,warename,price,warecount,pricelow
end sub
sub delcookies(delwarenum)
    warebuycount=Request("warebuycount")-1
    while Cint(delwarenum)<=Cint(warebuycount)
        setcookies Request.Cookies("warenum"+Cstr(delwarenum+1))("warenum"),Request.Cookies("warenum"+Cstr(delwarenum+1))("warename"),Request.Cookies("warenum"+Cstr(delwarenum+1))("price"),Request.Cookies("warenum"+Cstr(delwarenum+1))("warecount"),Request.Cookies("warenum"+Cstr(delwarenum+1))("pricelow"),delwarenum
补充:asp教程,高级应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,