blob: 04258782b7867157c357ee6de8d4eafd0c1e4a3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
---
title: window.document
slug: Web/API/Window/document
translation_of: Web/API/Window/document
---
<p>{{ ApiRef() }}</p>
<p><span class="seoSummary"><strong><code>window.document</code></strong>返回当前窗口内的文档节点({{domxref("document")}})</span></p>
<div class="note"><strong>注:</strong> {{ Fx_minversion_inline(3) }}从Firefox 3和IE7开始,访问其他页面内的文档节点会受到同源策略的影响.</div>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="eval notranslate"><em>doc</em> = window.document
</pre>
<h2 id="Parameters" name="Parameters">参数</h2>
<ul>
<li><code>doc</code>是一个指向{{domxref("document")}}对象的引用</li>
</ul>
<h2 id="Example" name="Example">例子</h2>
<pre class="brush:html notranslate"><!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<script type="text/javascript">
var doc = window.document;
alert( doc.title); // 弹出: Hello, World!
</script>
</body>
</html></pre>
<h2 id="Specification" name="Specification">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('HTML WHATWG', '#dom-document-2', 'Window.document')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td></td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'browsers.html#dom-document-0', 'Window.document')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("api.Window.document")}}</p>
|