真心求助。。请大家帮帮忙。谢谢了
4个文件 实现个简单的聊天室 但是提示错误 也没搞明白 请指教下,把代码复制到你那就OK,哪有问题帮忙看看,发个正确的万分感谢!
1:global.asa
<script language="vbscript" runat="server">
sub Application_OnStart
Application.Lock
'初如化聊天记录
dim msg(100)
for i=1 to 99
msg(i)="<br/>"
next
msg(100)="系统消息:欢迎来到简单聊天室!<br/>"
Application("msg")=msg
Application.UnLock
end sub
sub Application_OnEnd
end sub
</script>
2:index.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>简易APPLICATION聊天室</title>
</head>
<frameset rows="*,80" frameborder="no" border="0" framespacing="0">
<frame src="msg.asp" name="mainFrame" id="mainFrame">
<frame src="send.asp" name="bottomFrame" id="bottomFrame" scrolling="No" noresize="noresize">
</frameset>
<noframes><body>
</body>
</noframes></html>
3:msg.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="refresh" content="5;url=msg.asp" />
<title>显示消息</title>
</head>
<body>
<%
msg=application("msg")
for i=1 to 100
response.write msg(i)
next
%>
<p>
<script language="javascript">
top.mainFrame.scroll(0,document.body.scrollHeight*10);
</script>
</body>
</html>
4:send.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>发送消息</title>
</head>
<body>
<%
if request.QueryString("act")="send" then
session("user")=request.Form("user")
application.Lock()
msg=application("msg")
'将数组中的消息全部向前移,留出空位用来存放最新的消息
for i=1 to 99
msg(i)=msg(i+1)
next
msg(100)="[" & session("user") & "]说:" & request.Form("message") & " " & now() & "<br/>"
application("msg")=msg
application.UnLock()
end if
%>
<form id="form1" name="form1" method="post" action="send.asp?act=send">
用户名:
<input name="user" type="text" id="user" value="<%=session("user")%>"/>
<input type="submit" name="Submit" value="发送" />
<br />
要说的话:
<input name="message" type="text" id="message" size="70" maxlength="127" />
</form>
<script language="javascript">
document.form1.message.focus();
</script>
</body>
</html>