各位大侠小弟编写的购物车除了点问题!
错误类型:
Microsoft VBScript 编译器错误 (0x800A0400)
缺少语句
/viewcart.asp, line 76
<input type=button name="close" value="继续购物" onclick="window.close()">
源文件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<! --include file="config.inc"-->
<%
'函数sqlstr 用来规范sql查询语句
function sqlstr(data)
sqlstr="'" & replace(data,"'","''") & "'"
end function
'连接数据库
set conn=server.createobject("adodb.connection")
conn.open connstring
set objbuyrs=server.createobject("adodb.recordset")
if session("insert")=sessionid then
session("insert")=false
for each key in request.Cookies("itembuy")
response.Cookies("itembuy")
next
end if
if not request.Cookies("itembuy").haskeys then
response.Write "<font style=""font:10pt;color:ff0000"">目前您的购物车里还没有商品</font>"
session("hasitem")=false
response.Write "<input tyle=button value=""继续购物"" onclick=""window.close()"">"
else
point=1 '循环变量用来遍历cookies字典itembuy
count=cint(request.Cookies("itembuy".count) ) '字典关键字的数量
do while point<=count
if request.Cookies("itembuy")(point)="" then
point=point+1 '如果此关键字为空,则继续循环
else
exit do
end if
loop
if point>count then
response.Write "<font stlyle=""font:10pt;color:ff0000"">目前您的购物车里没有商品</font>"
session("hasitem")=false
response.Write "<hr color=#999933 size=1>"
response.Write "<input tyle=button value=""继续购物"" onclick=""window.close()"">"
else
response.Write "<font style=""font:10pt;color:ff0000"">您已经选择了以下商品<br>如果有您不需要的,在购买数中输入0就即可</font>"
response.Write "<hr color=#999933 size=1>"
response.Write "<center><table><tr><td width=50>编号</td><td width=150>名称</td><td width=100>单价</td><td width=100>购买数</td></tr>"
response.Write "<form action=""forinvoice.asp"" method=post target=""main"" name=""view"">"
do while point<=count
'获取商品的编号
productid=request.Cookies("itembuy")(point)
if productid="" then
point=point+1
else
ssql="select * from product where productid=" & sqlstr(productid)
objbuyrs.activeconnection=conn
objbuyrs.source=ssql
objbyrs.open
response.Write "<tr><td>" & objbuyrs("productid") & "</td>"
response.Write "<td>" & objbuyrs("name") & "</td>"
response.Write "<td>" &objbuyrs("price") & "</td>"
nametemp=objbuyrs("productid")
response.Write "<td><input type=text size=2 value=1 name=" & nametemp &"></td>"
response.Write "</tr>"
point=point+1
if point>request.Cookies("itembuy").count then
exit do
end if
objbuyrs.close
end if
loop
response.Write "</table>"
conn.close
set conn=nothing