基于web的QQ实现代码(asp) ——在网叶(web)上实现简单QQ功能(转)

本文介绍了一个基于Web的简易聊天系统实现方案,通过ASP技术完成信息发送、接收及显示功能。该系统支持每五秒更新一次在线状态及消息,适用于小规模即时通讯场景。

发送信息页面send.asp

 

发送信息页面send.asp
<html>
<head>
<title>发送信息页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%if request("text")="" then%>
<body bgcolor="#FFFFFF" text="#000000">
发送给:
<select size="1" name="name">
<%for i=1 to 30
if application("towho"
&i)=session("user") then
a=application("from"
&i)%>
<option checked><%=a%></option>
<%else if application("user"&i)<>then%>
<option><%=application("user"&i)%></option>
<%end if
end if
next%>
</select>
<br>
内容:
<textarea rows="2" name="text" cols="20"></textarea>
</body><%else
for i=1 to 30
if application("towho"&i)="" then
application(
"towho"&I)=request("name")
application(
"from"&i)=session("user")
application(
"text"&i)=request("text")
end if
if application("towho"&i)=session("user"then
application(
"towho"&i)=""
application(
"text"&i)=""
application(
"from"&i)=""
end if
next 


end if%>
</html>

 

接收信息页面inform.asp

接收信息页面inform.asp             
<%for i=1 to 30
if application("towho"&i)=session("user")
response.wtite(
"来自:"&application("from"&i)&"<br>"&"内容"&application("text"&i))
end if%>//有关回信息只要加键接到send.asp(自己补充)

 

显示页面show.asp

显示页面show.asp
<html>
<head>
<title>基于web的QQ程序1</title>
<meta http-equiv="refresh" content="5">//每五秒取得一次信息(前面已经完成了有关登录之类的工作)
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
//假设同时通信量为30
<%
response.write(
"现在在线:"&"<br>"
for i=1 to 30
if application("user"&i)=session("user"then
response.write(
"<font color=#FFFF00>")
response.write(session(
"user")&"</font>"
else
response.write(application(
"user"&i)&"<br>")
end if
if application("towho"&i)=session("user"then%> 


<script language="javascript">
window.open(
"inform.asp","","width=200,height=400")
</script> 

<%end if
next%>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值