English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML: Der <object>-Tag wird als Container verwendet, um externe Ressourcen in ein HTML-Dokument einzubinden, z.B. Audio, Video, Flash, PDF, externe Anwendungen oder Browser-Plugins. Aufgrund der Kompatibilitätsprobleme wird der <object>-Tag häufiger verwendet als der <embed>-Tag, um Ressourcen einzubinden. Dieser Tag wird auch oft als <object>-Element bezeichnet.
Verwenden Sie das <object>-Element, um Flash-Dateien in HTML einzufügen:
!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Grundlagen-Tutorial-Website(oldtoolbag.com)</title> </head> <body> <object type="application/x-shockwave-flash" src="bookmark.swf" width="400" height="300"></object> </body> </html>Testen Sie es heraus ‹/›
IEFirefoxOperaChromeSafari
目前大多数浏览器支持 <object> 标签。
定义一个嵌入的对象。请使用此元素向您的 XHTML 页面添加多媒体。此元素允许您规定插入 HTML 文档中的对象的数据和参数,以及可用来显示和操作数据的代码。
<object> 标签用于包含对象,比如图像、音频、视频、Java applets、ActiveX、PDF 以及 Flash。
object 的初衷是取代 img 和 applet 元素。不过由于漏洞以及缺乏浏览器支持,这一点并未实现。
浏览器的对象支持有赖于对象类型。不幸的是,主流浏览器都使用不同的代码来加载相同的对象类型。
而幸运的是,object 对象提供了解决方案。如果未显示 object 元素,就会执行位于 <object> 和 </> 之间的代码。通过这种方式,我们能够嵌套多个 object 元素(每个对应一个浏览器)。
与<embed>标签相比,<object>标签更常用于嵌入外部资源,因为<object>标签与HTML5,HTML 4.01和XHMTL兼容。
一些 HTML 4.01 属性在 HTML5 中不被支持。
"form" 是 HTML5 定义的新属性。
在 HTML5 中,objects 可以在form表单中提交。
在 HTML5 中,objects 不再出现在 <head> 元素区域内。
属性 | 值 | 描述 |
---|---|---|
align | top bottom middle left right | HTML5 Not supported. HTML 4.01 Deprecated. 规定 <object> 元素相对于周围元素的对齐方式。 |
archive | URL | HTML5 不支持。由空格分隔的指向档案文件的 URL 列表。这些档案文件包含了与对象相关的资源。 |
border | pixels | HTML5 Not supported. HTML 4.01 Deprecated. 规定 <object> 周围的边框宽度。 |
classid | class_ID | HTML5 不支持。定义嵌入 Windows Registry 中或某个 URL 中的类的 ID 值,此属性可用来指定浏览器中包含的对象的位置,通常是一个 Java 类。 |
codebase | URL | HTML5 不支持。定义在何处可找到对象所需的代码,提供一个基准 URL。 |
codetype | MIME_type | HTML5 不支持。通过 classid 属性所引用的代码的 MIME 类型。 |
data | URL | 定义对象使用的资源的 URL。 |
declare | declare | HTML5 Not supported. Defines that the object can only be declared, but cannot be created or instantiated until the object is applied. |
formHTML5 | form_id | Specifies one or more forms to which the object belongs. |
height | pixels | Specifies the height of the object. |
hspace | pixels | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the spacing to the left and right of the object. |
name | name | Specifies a name for the object. |
standby | text | HTML5 Not supported. Defines the text to be displayed while the object is loading. |
type | MIME_type | Specifies the MIME type of the data specified in the data attribute. |
usemap | #mapname | Specifies the name of the client-side image map to be used with the object. |
vspace | pixels | HTML5 Not supported. HTML 4.01 Deprecated. Specifies the spacing above and below the object. |
width | pixels | Specifies the width of the object. |
<object> Tag supports global attributes, see the complete attribute table HTML Global Attributes.
<object> Tag supports all HTML Event Attributes.
HTML Tutorial:HTML Object Element