ITPUB??ì3
ITPUB论坛 » WEB 2.0技术 » ajax问题 大家帮帮忙

新一届的微软MVP评选已经开始,欢迎各位推荐!

标题: ajax问题 大家帮帮忙
离线 Arraysellowang
初级会员


精华贴数 0
个人空间 0
技术积分 24 (49846)
社区积分 0 (1544575)
注册日期 2007-9-4
论坛徽章:0
      
      

发表于 2007-10-12 18:37 
ajax问题 大家帮帮忙

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Using responseText with innerHTML</title>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
    if (window.ActiveXObject)   // IE下创建XMLHTTPREQUEST
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP";
    }
    else if (window.XMLHttpRequest)   // 其他浏览器创建XMLHTTPREQUEST
    {
        xmlHttp = new XMLHttpRequest();
    }
}

function startRequest(){
   createXMLHttpRequest();
   xmlHttp.onreadystatechange = handleStateChange;
   xmlHttp.open("GET","innerHTML.xml",true);
   xmlHttp.send(null);
}
function handleStateChange(){
    if(xmlHttp.readyState == 4){
           if(xmlHttp.status == 200){
               document.getElementById("results".innerHTML = xmlHttp.responseText;
                   alert("haha";
           }
        }
}
</script>
</head>

<body>
  <form action="#">
      <input type="button" value="Search for Today's Activities">
  </form>
  <div id="results"></div>
</body>
</html>
帮我看看问题出在哪? 谢谢了


只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问