CNET中国旗舰网站

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





 
标题: [转贴] 还是关于xmlhttp的乱码问题
温柔的悲伤
银牌会员
Rank: 5Rank: 5



UID 307584
精华 0
积分 2467
帖子 178
威望 1164
ZD币 300 元
阅读权限 100
注册 2008-3-14
状态 离线
  楼主
发表于 2008-4-17 14:35  资料  个人空间  短消息  加为好友 
开发者在线

还是关于xmlhttp的乱码问题

写了段很简单的测试页,可就是中文显示不对,什么编码方式都试过了还是不行.下面是我的源码,哪位遇到过此类情况的帮忙看看,谢谢了!   
  <!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
  <html   xmlns="http://www.w3.org/1999/xhtml"   >   
  <head>   
          <meta   http-equiv="Content-Type"   c   />   
          <title>Disp   Extension   Status</title>   
          <script   type="text/javascript"   language="javascript">   
          window.onload=inibut;   
          function   inibut()   
          {   
                            var   btclick   =   document.getElementById("bt");   
                                    btclick.onclick   =   ExtRequest;   
          }   
      
          function   ExtRequest()   {   
            
          var   ExtNo=document.getElementById('ExtNo').value;   
          var   M;            
          xmlhttp_request   =   new   ActiveXObject("Microsoft.XMLHTTP");   
          xmlhttp_request.onreadystatechange   =   doContents;                 
          xmlhttp_request.open('POST',   MonitorURL,   true);   
          xmlhttp_request.setRequestHeader("Content-Type","text/html;charset=gb2312");         
          xmlhttp_request.send();   
   
            
      }   
          function   doContents()   {                  
          if   (xmlhttp_request.readyState   ==   4)     
                  {                           
                  if   (xmlhttp_request.status   ==   200)     
                  {   
                  alert(xmlhttp_request.getAllResponseHeaders());   
                  document.getElementById('st').innerHTML   =   xmlhttp_request.responseText;                        
                  }   else     
                  {                                   
                        alert(xmlhttp_request.status);                           
                      }                  
                  }   
              }      
                    
                  </script>   
  </head>   
  <body>   
  <div   id=et>et</div><input   type=text   id=ExtNo></input>   
  <input   type="button"   id="bt"   value="状态查询"></input>   
  <div   id=st>st</div>   
  <div   id=tt>tt</div>   
  </body>   
  </html>




顶部
 



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

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

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