aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/html/element/object/index.html
blob: e11fa6b51a0b63530ce0fd52fd7a413e63105d11 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
title: <object>
slug: Web/HTML/Element/object
tags:
  - Element
  - HTML
  - Web
translation_of: Web/HTML/Element/object
---
<h2 id="概要">概要</h2>

<p>{{HTMLRef}}<br>
 <strong>HTML <code>&lt;object&gt;</code> 元素</strong>(或者称作 <em>HTML 嵌入对象元素</em>)表示引入一个外部资源,这个资源可能是一张图片,一个嵌入的浏览上下文,亦或是一个插件所使用的资源。</p>

<p> </p>

<p>{{EmbedInteractiveExample("pages/tabbed/object.html", "tabbed-standard")}}</p>

<p> </p>

<ul class="htmlelt">
 <li><dfn><a href="/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">内容分类</a></dfn> <a href="/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>; <a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>; <a href="/en-US/docs/HTML/Content_categories#Embedded_content" title="HTML/Content categories#Embedded content">embedded content</a>, palpable content; if the element has a <strong>usemap</strong> attribute, <a href="/en-US/docs/HTML/Content_categories#Interactive_content" title="HTML/Content categories#Interactive content">interactive content</a>; <a href="/en-US/docs/HTML/Content_categories#Form_listed" title="HTML/Content categories#Form listed">listed</a>, <a href="/en-US/docs/HTML/Content_categories#Form_submittable" title="HTML/Content categories#Form submittable">submittable</a> <a href="/en-US/docs/HTML/Content_categories#Form-associated_content" title="HTML/Content categories#Form-associated content">form-associated</a> element.</li>
 <li><dfn>允许内容</dfn> zero or more {{HTMLElement("param")}} elements, then <a href="/en-US/docs/HTML/Content_categories#Transparent_content_models" title="HTML/Content categories#Transparent content models">Transparent content</a>.</li>
 <li><dfn>标签闭合</dfn> {{no_tag_omission}}</li>
 <li><dfn>允许的父级元素</dfn> Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Embedded_content" title="HTML/Content categories#Embedded content">embedded content</a>.</li>
 <li><dfn>DOM 接口</dfn> {{domxref("HTMLObjectElement")}}</li>
</ul>

<h2 id="属性">属性</h2>

<p><span style="line-height: 21px;">元素包含</span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">全局属性</a><span style="line-height: 21px;"></span></p>

<dl>
 <dt>{{htmlattrdef("archive")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>用来指名对象资源列表的以空格分隔的 URI 列表。</dd>
 <dt>{{htmlattrdef("border")}} {{deprecatedGeneric('inline','HTML4.01')}}; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>元素周围的边框的宽度,单位为像素。</dd>
 <dt>{{htmlattrdef("classid")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>对象实现的 URI,可以同时与 <strong>data</strong> 属性使用,或者使用 <strong>data</strong> 属性替代。</dd>
 <dt>{{htmlattrdef("codebase")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>解析 <strong>classid</strong><strong>data</strong> 或者 <strong>archive</strong> 中定义的相对路径的根路径,如果没有定义,默认为当前文档的 base URI。</dd>
 <dt>{{htmlattrdef("codetype")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd><strong>classid</strong> 定义的 data 的内容类型。</dd>
 <dt>{{htmlattrdef("data")}}</dt>
 <dd>一个合法的 URL 作为资源的地址,,需要为 <strong>data</strong><strong>type </strong>中至少一个设置值。</dd>
 <dt>{{htmlattrdef("declare")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>取值为布尔的属性可以设置这个元素为仅声明的格式。对象必须被随后的 <code>&lt;object&gt; 元素实例化。在</code> HTML5 中,完整的重复 &lt;object&gt; 元素,可以重用元素。</dd>
 <dt>{{htmlattrdef("form")}} {{HTMLVersionInline(5)}}</dt>
 <dd>对象元素关联的 form 元素(属于的 form)。 取值必须是同一文档下的一个 {{HTMLElement("form")}} 元素的 ID。</dd>
 <dt>{{htmlattrdef("height")}}</dt>
 <dd>资源显示的高度,单位是 CSS 像素。</dd>
 <dt>{{htmlattrdef("name")}}</dt>
 <dd>浏览上下文名称(HTML5),或者控件名称(HTML 4)。</dd>
 <dt>{{htmlattrdef("standby")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>对象的实现和数据加载过程中,浏览器可以显示的信息。</dd>
 <dt>{{htmlattrdef("tabindex")}} {{HTMLVersionInline(4)}} only; {{obsoleteGeneric('inline','HTML5')}}</dt>
 <dd>当前元素在文档 Tab 导航中的顺序。</dd>
 <dt>{{htmlattrdef("type")}}</dt>
 <dd><strong>data</strong> 指定的资源的 MIME 类型,需要为 <strong>data</strong><strong>type </strong>中至少一个设置值。</dd>
 <dt>{{htmlattrdef("usemap")}}</dt>
 <dd>指向一个 {{HTMLElement("map")}} 元素的 hash-name;格式为 ‘#’ 加 map 元素 {{htmlattrxref("name", "map")}} 元素的值。</dd>
 <dt>{{htmlattrdef("width")}}</dt>
 <dd>资源显示的宽度,单位是 CSS 像素。</dd>
</dl>

<h2 id="示例">示例</h2>

<pre class="brush: html">&lt;!-- Embed a flash movie --&gt;
&lt;object data="move.swf" type="application/x-shockwave-flash"&gt;&lt;/object&gt;

&lt;!-- Embed a flash movie with parameters --&gt;
&lt;object data="move.swf" type="application/x-shockwave-flash"&gt;
  &lt;param name="foo" value="bar"&gt;
&lt;/object&gt;
</pre>

<h2 id="Specifications" name="Specifications">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'the-iframe-element.html#the-object-element', '&lt;object&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'the-object-element.html#the-object-element', '&lt;object&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'objects.html#h-13.3', '&lt;object&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<p>{{Compat("html.elements.object")}}</p>

<p> </p>

<h2 id="参阅">参阅</h2>

<ul>
 <li>{{HTMLElement("applet")}} {{Obsolete_Inline}}</li>
 <li>{{HTMLElement("embed")}}</li>
 <li>{{HTMLElement("param")}}</li>
</ul>

<p> </p>