顺德万达广场:那位高手帮助我看看ASP代码那里有语法错误?

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/06 00:46:27
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
name=request.Form("name")
same_flag=false
if not isarray(application("userlist"))then
dim U()
redim U(0)
U(0)="大家"
application.Lock
application("userlist")=U
application.UnLock
else
user=application("userlist")
for i=0 to ubound(user)
if user(i)=name then
same_flag=true
end if
next
end if
if trim(name)=""or same_flag then
response.Redirect"log.asp"
else
user1=application("usrerlist")
N=Ubound(user1)
redim preserve user1(N+1)
user1(N+1)=name
application.Lock
application("userlist")=user1
application.UnLock
end if
%>

<html>
<head>
<title>talk.asp</title>
</head>
<frameset rows="*,100">
<frameset cols="*,150">
<frame src="message.asp" name="message" scr="message.asp">
<frame src="userlist.asp" name="user" scr="userlist.asp">
</frameset>

<frame src="say.asp" name="say" scr="say.asp?name=<%=name%>">
</frameset><noframes></noframes>
</html>
这位朋友说的不对呀...
系统提示:
错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'ubound'
第 25 行

朋友:grkz,我试了..还上一样的错误...
还是不行...

ubound()函数的作用是获取数组下标

if not isarray(application("userlist"))then
'判断userlist不为数组
dim U()
redim U(0) '重定义一个数组U()变量
U(0)="大家"
application.Lock
application("userlist")=U '将数组U附给userlist
application.UnLock

else
'判断userlist是数组
user=application("userlist")
for i=0 to ubound(user) '获取userlist里现有数组下标
if user(i)=name then '判断name是否存在于userlist里
same_flag=true
end if
next
end if
if trim(name)=""or same_flag then
response.Redirect"log.asp"

else 'name不存在于userlist里,下面则添加name到userlist

user1=application("usrerlist")
'这里你应该加一句if not isarray(application("userlist"))then
if not isarray(application("userlist"))then
user1(0)=name
else
N=Ubound(user1)
redim preserve user1(N+1)
user1(N+1)=name
end if
application.Lock
application("userlist")=user1
application.UnLock
end if

先这么试试:)

frame src="message.asp" name="message" SRC="message.asp">
<frame src="userlist.asp" name="user" SRC="userlist.asp">
<frame src="say.asp" name="say" SRC="say.asp?name=<%=name%>">
请注意大写字母

application 对象不能做为数组类型的变量来使用,还是用
dim user
user=数组
吧。