asp即时消息的实现

来源:互联网 发布:js按钮隐藏和显示div 编辑:程序博客网 时间:2024/05/17 22:44

首先要在框架中添加一个隐藏页,如下:

<html>
<head>
< http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<sc ript language="java">
re()
{
setTimeout("re()",30000);
ipopmsg.location.href=" search.asp"
}
</sc ript>
</head>
<body topmargin="0" leftmargin="0" ="re();" >
<i height="1" scrolling="no" border="0" width="1" id="ipopmsg"  src=" blank"></i>
</body>
</html>

这个页面的功能是没隔30000毫秒刷新一次search.asp这个页面。下面是search.asp的代码

<head>
<%
set rs=server.createobject("adodb.recordset")
sql="select id from XXXX where xxxx"
rs.open sql,conn,3,2
if not rs.eof then
%>
 <sc ript language="java">
  newwin=open ("new.asp?id=<%=rs("ID")%>","","top=50,left=50,width=420,height=262,menubar=no,status=no,scrollbars=yes,location=no,toolbar=no")
  newwin.focus();
 </sc ript>
<%
end if
rs.close
set rs=nothing
connend
%>
</head>

这样如果有符合查询条件的消息,就会弹出new.asp页,同时把id传过去,下面就是弹出页怎么显示了,这里就不详细写了。

 
原创粉丝点击