document与Document的区别? 如题。貌似在哪看到过说是有点区别,忘记了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Document 不标准的,亦未见人使用,经测试ie直接报错,谷歌有此函数但无法调用,火狐浏览器可返回一个document对象(Document()或new Document()),但与页面的document对象不等,故猜测浏览器用其来作为document对象的构造函数,非供开发者使用 你是不是想问 Ifram框架自适应 问题呢?<script language="javascript"> function SetsHeight()//自动拉伸高度 { var xsun = document.getElementById("main"); //iframe id //var h1 = xsun.contentDocument.body.offsetHeight; var h2 = document.documentElement.offsetHeight; if (document.getElementById) { if (xsun && !window.opera) { if (xsun.contentDocument && h2) { xsun.height = h2 + 20; } else if (xsun.Document && xsun.Document.body.scrollHeight) { xsun.height = h2 + 20; } } } } </script>调用方法:<iframe frameborder="0" id="main" name="main" onload="javascript:SetsHeight();" src="1.html" marginwidth="0" marginheight="0" scrolling="no" style="z-index: 1; width: 100%; min-height: 300px;"></iframe>如果不是 Document 是不是你自定义的呢 documentDocument为什么要比较区别呢 是指通过IE Borowser组件来引用文档对象吗? <!DOCTYPE html><html><head><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script> alert(document instanceof Document);</script></head><body><p>如果您点击我,我会消失。</p><p>点击我,我会消失。</p><p>也要点击我哦。</p></body></html>测试下,document是Document的实例 测试过了。在Chrome和Firefox上是true,ie上Document未定义。 测试过了。在Chrome和Firefox上是true,ie上Document未定义。ie可能不让直接访问,像__proto__ ajax请求成功后返回的data怎么比较? <a> rel 属性和onclick 不能同时存在 ext 查询,GridPanel怎么重新加载数据? 左侧的焦点图效果 如何设计在原图片区域更换图片 onmouseover javascript联动有没有框架啊 javascript读取xml问题 如何根据下拉框选择的内容来决定单选按钮的默认选择? 如何用腳本指定一個frame的src啊﹖ 如何直接动态改变图片大小? 有一个表格 我想点击一个按钮 让他增加一行~然后表格里的内容跟上一行一样~ 关于this的小问题
ie直接报错,谷歌有此函数但无法调用,
火狐浏览器可返回一个document对象(Document()或new Document()),但与页面的document对象不等,
故猜测浏览器用其来作为document对象的构造函数,非供开发者使用
<script language="javascript">
function SetsHeight()//自动拉伸高度
{
var xsun = document.getElementById("main"); //iframe id
//var h1 = xsun.contentDocument.body.offsetHeight;
var h2 = document.documentElement.offsetHeight;
if (document.getElementById) {
if (xsun && !window.opera) {
if (xsun.contentDocument && h2) {
xsun.height = h2 + 20;
} else if (xsun.Document && xsun.Document.body.scrollHeight) {
xsun.height = h2 + 20;
}
}
}
}
</script>调用方法:<iframe frameborder="0" id="main" name="main" onload="javascript:SetsHeight();"
src="1.html" marginwidth="0" marginheight="0" scrolling="no" style="z-index: 1; width: 100%; min-height: 300px;"></iframe>如果不是 Document 是不是你自定义的呢
Document为什么要比较区别呢
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
alert(document instanceof Document);
</script>
</head>
<body>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>测试下,
document是Document的实例
测试过了。在Chrome和Firefox上是true,ie上Document未定义。ie可能不让直接访问,像__proto__