主题:求助 利用createPopup() 作论坛消息及时提醒
-------------------------jiance5-1.asp---------------------------
<script language="javascript">
if(typeof(XMLHttpRequest)=="undefined" && window.ActiveXObject)
{
function XMLHttpRequest()
{
var xmlhttp_arr=["MSXML2.XMLHTTP","Microsoft.XMLHttp"];
var xml_request;
for(var i=0;i<xmlhttp_arr.length;i++)
{
if(xml_request=new ActiveXObject(xmlhttp_arr[i]))
break;
}
return xml_request;
}
}
var xml_http_request=new XMLHttpRequest();
function check_news()
{
xml_http_request.open("GET","jiance5-2.asp",true);
xml_http_request.onreadystatechange=newwin;
xml_http_request.send(null);
setTimeout("check_name()",1000);
}
function newwin()
{
if(xml_http_request.readyState==4)
{
if(xml_http_request.status==200)
{
var res=xml_http_request.responseText;
if(res=="test")
{
var popup =createPopup();
var winstr ="您有新消息";
var opopup = popup.document.body;
opopup.style.background="lightyellow";
opopup.style.border="solid blue 1px";
opopup.innerHTML=winstr;
popup.show(100,100,1000,100 ,(document.body));
}
}
}
}
</script>
</head>
<body onload="check_news()">
</body>
---------------------------jiance5-2.asp----------------------------
<!--#include file="conn.asp"-->
<%
Dim oRs,sSql
Set oRs=Server.CreateObject("ADODB.RecordSet")
sSql="select * from tbMessage where readflag=0" //readflag=0 表示消息未读
oRs.open sSql,objConn,1,1
if NOT(oRs.eof and oRs.bof) then
response.Write("test")
end if
oRs.close
set oRs=nothing
objConn.close
set objConn=nothing
%>
----------------------------------------------------------------------
以上代码我想实现及时监测论坛消息,如果有未读的消息就会弹出一个Popup窗口提示有未读的消息,现在的问题是当我将消息都设置为 已读(readflag=1)后,还是不停的提示有新消息,请问这是怎么回事啊
<script language="javascript">
if(typeof(XMLHttpRequest)=="undefined" && window.ActiveXObject)
{
function XMLHttpRequest()
{
var xmlhttp_arr=["MSXML2.XMLHTTP","Microsoft.XMLHttp"];
var xml_request;
for(var i=0;i<xmlhttp_arr.length;i++)
{
if(xml_request=new ActiveXObject(xmlhttp_arr[i]))
break;
}
return xml_request;
}
}
var xml_http_request=new XMLHttpRequest();
function check_news()
{
xml_http_request.open("GET","jiance5-2.asp",true);
xml_http_request.onreadystatechange=newwin;
xml_http_request.send(null);
setTimeout("check_name()",1000);
}
function newwin()
{
if(xml_http_request.readyState==4)
{
if(xml_http_request.status==200)
{
var res=xml_http_request.responseText;
if(res=="test")
{
var popup =createPopup();
var winstr ="您有新消息";
var opopup = popup.document.body;
opopup.style.background="lightyellow";
opopup.style.border="solid blue 1px";
opopup.innerHTML=winstr;
popup.show(100,100,1000,100 ,(document.body));
}
}
}
}
</script>
</head>
<body onload="check_news()">
</body>
---------------------------jiance5-2.asp----------------------------
<!--#include file="conn.asp"-->
<%
Dim oRs,sSql
Set oRs=Server.CreateObject("ADODB.RecordSet")
sSql="select * from tbMessage where readflag=0" //readflag=0 表示消息未读
oRs.open sSql,objConn,1,1
if NOT(oRs.eof and oRs.bof) then
response.Write("test")
end if
oRs.close
set oRs=nothing
objConn.close
set objConn=nothing
%>
----------------------------------------------------------------------
以上代码我想实现及时监测论坛消息,如果有未读的消息就会弹出一个Popup窗口提示有未读的消息,现在的问题是当我将消息都设置为 已读(readflag=1)后,还是不停的提示有新消息,请问这是怎么回事啊