document与Document的区别?

孤飞不倦 2013-09-04 05:22:24
如题。
貌似在哪看到过说是有点区别,忘记了。
...全文
174 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2013-09-05
  • 打赏
  • 举报
回复
是指通过IE Borowser组件来引用文档对象吗?
  • 打赏
  • 举报
回复
你alert(document.constructor);试试
  • 打赏
  • 举报
回复
引用 6 楼 imi233 的回复:
[quote=引用 5 楼 veryhunger 的回复:]
<!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未定义。[/quote]ie可能不让直接访问,像__proto__
孤飞不倦 2013-09-05
  • 打赏
  • 举报
回复
引用 5 楼 veryhunger 的回复:
<!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未定义。
  • 打赏
  • 举报
回复
<!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的实例
KK3K2005 2013-09-04
  • 打赏
  • 举报
回复
document Document 为什么要比较区别呢
程序员鼓励师 2013-09-04
  • 打赏
  • 举报
回复
你是不是想问 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 是不是你自定义的呢
未知数 2013-09-04
  • 打赏
  • 举报
回复
Document 不标准的,亦未见人使用,经测试 ie直接报错,谷歌有此函数但无法调用, 火狐浏览器可返回一个document对象(Document()或new Document()),但与页面的document对象不等, 故猜测浏览器用其来作为document对象的构造函数,非供开发者使用

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧