我每隔两秒度曲服务器的数据库,取字段bz为1的记录个数,如果不为0,则参数就为true,反之为false,并且返回这个参数值.返回值为TRUE就会弹出消息提示,但是我不知道该怎么返回这个值,下面是我的代码是哪里出现了问题
demo.asp:
<html>
<head>
<meta http-equiv="Content-Type" c>
<title>有新的消息提示</title>
<script language="javascript">
function refresh()
{
//2秒自动刷新一次,2秒取得一次数据.
timer = window.setInterval("loadData()",4000);
}
</script>
<script language="javascript">
<!--
function loadData(){
var Had = false;
url = "refresh.asp";
var httpRequest;
if (typeof XMLHttpRequest != 'undefined') {
httpRequest = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined') {
httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
}
if (httpRequest) {
httpRequest.open('GET', url, false);
httpRequest.send(null);
if( httpRequest.readyState == 4 )
{
if( httpRequest.status == 200 )
var strinfo=httpRequest.ResponseText;
if(strinfo=="true" ) Had=true;
}}
if(Had) {
shownewmessage();
}
//-->
//-->
function shownewmessage(){
window.status=popTop;
if(popTop>1720){
clearTimeout(mytime);
oPopup.hide();
return;
}else if(popTop>1520&&popTop<1720){
oPopup.show(screen.width-250,screen.height,241,1720-popTop);
}else if(popTop>1500&&popTop<1520){
oPopup.show(screen.width-250,screen.height+(popTop-1720),241,172);
}else if(popTop<180){
oPopup.show(screen.width-250,screen.height,241,popTop);
}else if(popTop<220){
oPopup.show(screen.width-250,screen.height-popTop,241,172);
}
popTop+=10;
}
popmsg(" 系统提示:有新的审核信息,请及时查看!");
</script>
</head>
<body >
<div id="userList"></div>
</body>
</html>
refresh.asp:
<%@ language="javascript"%>
<%
//连接数据库
var conn=Server.CreateObject("ADODB.Connection");
conn.Open("

ROVIDER=SQLOLEDB;SERVER=aaa;DATABASE=bbb;UID=sa

WD=;");
var rs=Server.CreateObject("ADODB.RECORDSET");
var query;
query="select * from table where bz='0'";
rs.Open(query,conn,3,3);
var strnum;
if (rs.RecordCount!="0"){
strnum=true;
}
else{
strnum=false;
}
Response.write (strnum)
%>
.