onClick="java script:window.open('shoucang.asp?id=<%=rs("bookid")%>&action=add ','','width=632,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;" type=button value=收藏 name=Submit223>
‘如果你添加过了,会有提示,“对不起,此商品已存在于您的收藏架中,不可以重复添加!”
'//收藏,判断是否存在
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,username from shop_action where username='"&username&"' and bookid="&bookid&" and zhuangtai=6",conn,1,1
if not rs.eof and not rs.bof then
response.write "<script language=java script>alert('对不起,此商品已存在于您的收藏架中,不可以重复添加!');window.location.reload('shoucang.asp?action=show')</script>"
response.end
rs.close
set rs=nothing
else
‘当你的收藏架上的书籍超过10本时,系统会提示你“对不起,您的商品收藏已超过10个!”将不可以再继续进行收藏。
'//判断收藏数
if rs.recordcount=10 then
response.write "<script language=java script>alert('对不起,您的商品收藏已超过10个!');window.location.reload('shoucang.asp?action=show')</script>"
response.end
else
rs.close
set rs=nothing
‘并且告诉您您最多只能收藏十种商品
<%response.write "<table width=96% border=0 align=center cellpadding=2 cellspacing=2><tr><td width=60% >"
response.write "<img src=images/wishlist.gif width=159 height=43></td><td width=40% valign=baseline><div align=right>您最多只能收藏十种商品</div></td></tr></table>"
shoucang()
end select%>
‘当然,你的收藏架上的书在你的精心挑选过后,有些你不是很喜欢了,那么你可以把你还喜欢的留着,不喜欢了的删除掉,我们专门为您准备了垃圾桶。
'//删除收藏
select case action
case "del"
conn.execute "delete from shop_action where actionid="&request.QueryString("actionid")
if request.QueryString("ll")=22 then
response.redirect "myuser.asp?action=shoucang"
else
response.redirect "shoucang.asp?action=show"
end if
response.End
case "add"
4.7 设计第一份订购表单
当您第一次进行购买时,只要点击了[购买]就会进入第一份购买表单。先确定是否选择了书籍:
<%dim bookid,action,i
action=request.QueryString("action")
if request.QueryString("id")="" then
bookid=request("bookid")
else
bookid=request.QueryString("id")
end if
if bookid="" then
response.write "<script language=java script>alert('对不起,您没有选择商品!');window.location.reload('java script:window.close()')</script>"
response.End
‘如果没有选择书籍,则会跳出‘对不起,您没有选择商品’的对话框。如果选择了商品,那么会显示书籍的[商品名称] [市场价][折扣][数量][小计][修改数量]等信息。
select case action
'//////////////////////////////////
case ""
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,bookname,shichangjia,huiyuanjia,dazhe from shop_books where bookid in ("&bookid&") order by bookid",conn,1,1%>
<table width="96%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<form name="form1" method="post" action="">
<tr>
<td width="48%" bgcolor="#5F95D3"><div align="center"><font color="#FFFFFF">商品名称</font></div></td>
<td width="13%" bgcolor="#5F95D3"><div align="center"><font color="#FFFFFF">市场价</font></div></td>