52,792
社区成员




<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(){
createXMLHttpRequest();
try{
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "http://www.baidu.com", true);
xmlHttp.send(null);
}catch(exception){
alert("您要访问的资源不存在!");
}
}
function handleStateChange(){
if(xmlHttp.readyState == 4){
if (xmlHttp.status == 200 || xmlHttp.status == 0){
// 显示返回结果
var bbb=(xmlHttp.responseText); //--这里面bbb是百度返回的整个页面源代码
alert(document.getElementById("km").innerHTML);//--我想取百度里面哪个ID为km的标签的数据,如何做呢
}
}
}
</script>