CNET中国旗舰网站

ZDNet China | CNET科技资讯网 | 政府采购 | 行业网站联盟





 
标题: [转贴] 怎么返回httpRequest的值?急!!!
mz89757053
版主
Rank: 7Rank: 7Rank: 7


UID 304999
精华 0
积分 6933
帖子 8295
威望 116
ZD币 1002 元
阅读权限 250
注册 2008-3-10
状态 离线
  楼主
发表于 2008-3-18 14:02  资料  个人空间  短消息  加为好友 
开发者在线

怎么返回httpRequest的值?急!!!

我每隔两秒度曲服务器的数据库,取字段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=saWD=;");      
  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)      
  %>      
  .




顶部
热点频道推荐: C/S开发| 数据库| WEB开发| 嵌入式| 项目管理|
mz89757053
版主
Rank: 7Rank: 7Rank: 7


UID 304999
精华 0
积分 6933
帖子 8295
威望 116
ZD币 1002 元
阅读权限 250
注册 2008-3-10
状态 离线
  沙发
发表于 2008-3-18 14:02  资料  个人空间  短消息  加为好友 
refresh.asp:      
  <%@     language="javascript"%>      
  <%      
  //连接数据库      
  var     conn=Server.CreateObject("ADODB.Connection");      
  conn.Open("ROVIDER=SQLOLEDB;SERVER=aaa;DATABASE=bbb;UID=saWD=;");      
  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)      
  %>      
   
  如果strnum=true;     不加引号返回的就是"True"了




顶部
热点频道推荐: C/S开发| 数据库| WEB开发| 嵌入式| 项目管理|
 



当前时区 GMT+8, 现在时间是 2009-7-5 02:14

  Powered by Discuz! 5.5.0 © 2001-2007 Comsenz Inc.
Processed in 0.059010 second(s), 3/3 queries

清除 Cookies - 联系我们 - ZDNetChina中文社区 - 无图版