求助ASP编程

来源:百度知道 编辑:UC知道 时间:2024/05/15 23:42:26
通过<a href="cartdet.asp?ID=<%=arr_spid%>">传递ID
cartdet.asp
<%
function remove(spid)
if isarray(session("arr")) then
arr=session("arr")
UB=Ubound(arr,1)
if UB=0 then
session("arr")=""
else
flag=false
redim arr_temp(UB-1,2)
for i=0 to UB
if arr(i,0)<>spid then
for j=0 to 2
if flag then
arr_temp(i-1,j)=arr(i,j)
else
arr_temp(i,j)=arr(i,j)
end if
Next
else
flag=true
end if
next
end if
end if
session("arr")=arr_temp
end function

if request.QueryString("ID")<>"" then
call.remove(request.QueryString("ID"))
end if
response.Redirect("cart.asp")

%>
出现错误:
错误类型:
Microsoft VBScript 运行时错误 (0x800A01F9)
无效的或无资格的引用
/g

call是对应sub函数的,再说你上面的即使是sub函数,你的写法也不对,应写成
call remove(request.QueryString("ID"))
因为上面是function函数,所以你应把
call.remove(request.QueryString("ID"))
改写为
remove(request.QueryString("ID"))
即可