Latest web development tutorials

HTML <object> tag

Examples

Use <object> element in HTML add Flash files:

<object width="400" height="400" data="helloworld.swf"></object>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Most browsers support <object> tag.


Tag definitions and instructions

The definition of an embedded object. Use this to add multimedia elements to your XHTML pages. This element allows you to insert data and parameters specified in the HTML document object, as well as the code used to display and manipulate data.

<Object> tag is used to contain objects such as images, audio, video, Java applets, ActiveX, PDF and Flash.

The object is to replace the original intention img and applet elements. However, because of the vulnerability and lack of browser support, it did not materialize.

Browser object supports depends on the object type. Unfortunately, the major browsers use different code to load the same object type.

And fortunately, object object provides a solution. If the object element is not displayed, it will execute the code located in the <object> and </ object> between. In this way, we can nest multiple object elements (one for each browser).


HTML 4.01 and HTML5 differences in

Some HTML 4.01 attributes are not supported in HTML5.

"Form" is the new property HTML5 definition.

In HTML5, objects can be submitted in the form form.

In HTML5, objects no longer appear in the <head> element area.


Attributes

New: HTML5 new property.

属性 描述
align top bottom middle left right HTML5 不支持。HTML 4.01 已废弃。 规定 <object> 元素相对于周围元素的对齐方式。
archive URL HTML5 不支持。由空格分隔的指向档案文件的 URL 列表。这些档案文件包含了与对象相关的资源。
border pixels HTML5 不支持。HTML 4.01 已废弃。 规定 <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 不支持。定义该对象仅可被声明,但不能被创建或例示,直到该对象得到应用为止。
form New form_id 规定对象所属的一个或多个表单。
height pixels 规定对象的高度。
hspace pixels HTML5 不支持。HTML 4.01 已废弃。 规定对象左侧和右侧的空白。
name name 为对象规定名称。
standby text HTML5 不支持。定义当对象正在加载时所显示的文本。
type MIME_type 规定 data 属性中规定的数据的 MIME 类型。
usemap #mapname 规定与对象一同使用的客户端图像映射的名称。
vspace pixels HTML5 不支持。HTML 4.01 已废弃。 规定对象的顶部和底部的空白。
width pixels 规定对象的宽度。


Global Properties

<p> tag supports the global attributes, view complete the property sheet HTML Global Attributes .


Event Properties

<p> tag supports all HTML event attributes .


related articles

HTML Tutorial: HTML Object element