真心求助。。请大家帮帮忙。谢谢了

yiguan 2007-09-21 10:36:49

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>


...全文
96 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yiguan 2007-09-21
  • 打赏
  • 举报
回复
已解决

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧