<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ajax test</title>
<link type='text/css' rel='stylesheet' href='../css/ajax.css' />
</head>
<body>
<div id='root'></div>
<div id='content'></div>
<script type="text/javascript">
var http;
http=new XMLHttpRequest();//had got
function chuli(url){
http.onreadystatechange=showcnt();
http.open('GET',url);
http.send();
}
function showcnt(){
if(http.readyState===4){
if(http.status===200){
document.getElementById('content').innerHTML=http.responseText;
}
}
}
document.getElementById('root').onclick=function(){chuli('data.txt');};
</script>
</body>
</html>
firfox核心可以运行
ie下加载上ie的httpRequest就可以了
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。