当前位置:首页 > 网络编程 > WEB编程 > ASP > ASP基础实例教程之ASP中简单购物车实例

ASP基础实例教程之ASP中简单购物车实例

点击次数:41 次 发布日期:2008-12-01 17:05:59 作者:源代码网
源代码网推荐 说明:本实例主要用session来存储购买的物品.文件包括有order.asp [第一个购买页面],order1.asp
[第二个购物页面,就两个购物页面,如果多个,可以仿这两个写] view.asp [查看购买物品,主要为了检验
session 传过来的物品] order2.asp [类似order1.asp,实现多个页面购物,这个自己按需要写]
buy.asp [付账页面,没有写]

以下是order.asp
CODE:
<%@ Language=VBScript codepage="936" %>
<html>
<head>
<title>购买水果</title>
</head>
<body>
请选择你所要购买的水果
<hr>
<form action="order.asp">
<input name="fruit" type=checkbox value="苹果">苹果
<Br>
<input name="fruit" type=checkbox value="香蕉">香蕉
<Br>
<input name="fruit" type=checkbox value="菠萝">菠萝
<Br>
<input name="fruit" type=checkbox value="桔子">桔子
<input type=submit value="订购">
</form>
<hr>
<%
dim store
if Request.QueryString("fruit").Count=0 then
%>
你没有购买水果
<%else
response.write "你购买的水果有:"
store=request("fruit")
   response.write "<br><font color=green>" & store & "</font>"
session("aa")=store
end if
%>
<a href="order1.asp">继续购物</a>
</body>
</html>
 



以下为order1.asp
CODE:
<%@ Language=VBScript codepage="936"%>
<html>
<title>购物书本</title>
<body>
<%
dim aa
aa=session("aa")
%>
请选择你所要购买的课本
<hr>
<form action="order1.asp">
<input name="book" type=checkbox value="高数">高数
<Br>
<input name="book" type=checkbox value="英语">英语
<Br>
<input name="book" type=checkbox value="化学">化学
<Br>
<input name="book" type=checkbox value="物理">物理
<input type=submit value="购买">
</form>
<hr>
<%
dim store
if submit=null then
%>
你没有购买书本
<hr>
上次买的水果有:
<%
=aa
%>
<%else
response.write "你购买的书有:"
store=request("book")
   response.write "<br><font color=green>" & store & "</font><hr>"
response.write "你购买的水果有:"
response.write "<br><font color=green>" & aa & "</font><hr>"
session("bb")=store&","&aa
end if
%>
<br>
<a href="order2.asp">继续购物</a><br>
<a href="view.asp">查看已购买物品</a><br>
<a href="buy.asp">不买了,去结账</a>
</body>
</html>
 



以下是view.asp
CODE:
<%
dim bb
bb=session("bb")
response.write "以下是你购买的物品:"&bb
%>
 

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华