window属性:document

2018-04-04 10:45 更新

document属性

window.document 返回对窗口中包含的文档的引用。

注意: 

Firefox 3 改变了 Windows 文档的安全性,因此只有它所在的域可以访问文档。

虽然这可能会破坏一些现有的网站,但这是 Firefox 3 和 Internet Explorer 7 所做的一项举措,并且会提高安全性。

document属性语法

doc = window.document 

document属性参数

  • doc 是对 document 的对象引用。

document属性示例

以下是一个 document 属性示例:

<!DOCTYPE html>
<html>
<head>
   <title>Hello, World!</title>
</head>
<body>

<script type="text/javascript">
   var doc = window.document;
   console.log(doc.title); // Hello, World!
</script>

</body>
</html>

规范

规范状态注释
HTML Living Standard
在该规范中定义了'Window.document'。
Living Standard
 
HTML5 
该规范中'Window.document'的定义。
Recommendation
 
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号