javascript 怎么获取<html></html>里的内容 小问题 分数少 立即给分

来源:百度知道 编辑:UC知道 时间:2024/06/14 14:37:24
document.body.innerHTML 只能获取 <body>的内容
我想得到
整个文档的内容
小问题 就求一个函数 分数少

document.documentElement.innerHTML

document就是整个文档对象。
常用的就是下面这些属性,希望对你有用。
1、anchors[]:文档对象中的锚。
2、applets[]:文档对象中的Java小程序。
3、forms[]:Form对象的数组,代表文档对象中的<form>元素。
4、images[]:Image对象的数组,代表文档对象中的<img>元素。
5、links[]:Link对象的数组,代表文档对象中的超链接元素。
6、title:<title>和</title>之间的文本。

http://blog.sina.com.cn/yhzone

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("GET","http://www.baidu.com", false);
try {
xmlhttp.send();
var result = xmlhttp.status;
}catch(e){
return false;
}
if(result==200) {
alert(xmlhttp.responseText);
}
delete(xmlhttp)