标题:我写了一段代码从服务器返回值,在IE中执行就能取到值,但是在Mozilla Fire ...
取消只看楼主
kevinwei123
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-1-19
 问题点数:0 回复次数:0 
我写了一段代码从服务器返回值,在IE中执行就能取到值,但是在Mozilla Firefox却总是返回为空
具体代码如下:有高手遇到过这个问题吗?
<html>
<head>
<script>
var xmlhttp;
function setxmlhttp()
{
 
 if(window.ActiveXobject)
 {
  
  xmlhttp=new ActiveXobject('Microsoft.XMLHTTP');
 
 }
 else if(window.XMLHttpRequest)
 {
 
  xmlhttp=new XMLHttpRequest();
  
 }
}
function xmlrequest(xx)
{
 setxmlhttp();
 alert(xmlhttp);
 xmlhttp.open("GET",xx,true);
 xmlhttp.onreadystatechange=indiv;
 xmlhttp.send(null);
 document.getElementById("ts").innerHTML="正在获取数据,请稍候...";
}
function indiv()
{
 if(xmlhttp.readyState==4){
  if(xmlhttp.status==200||xmlhttp.status==0){
    document.getElementById("ts").innerHTML="请求完毕";
   document.getElementById("div").innerHTML=xmlhttp.responseText;
   alert(xmlhttp.responseText);
  }else{
  alert("发生错误"+xmlhttp.status);
  }
}
}
搜索更多相关主题的帖子: 服务器 null 
2011-01-19 12:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-331282-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.838047 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved