HTML Object tag


Add an object to an HTML page:
<object classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628" id="Slider1" width="100" height="50">
  <param name="BorderStyle" value="1" />
  <param name="MousePointer" value="0" />
  <param name="Enabled" value="1" />
  <param name="Min" value="0" />
  <param name="Max" value="10" />

Definition and Usage

The <object> tag is used to include objects such as images, audio, videos, Java applets, ActiveX, PDF, and Flash.
The object element was intended to replace the img and applet elements. However, because of bugs and a lack of browser support this has not happened.
The object support in browsers depend on the object type. Unfortunately, the major browsers use different codes to load the same object type.
Luckily, the object element provides a solution. If the object element is not displayed, the code between the <object> and </object> tags will be executed. This way we can have several nested object elements (one for each browser).

Browser Support

The <object> tag is partially supported in all major browsers.

Differences Between HTML and XHTML


Tips and Notes

Note: The <param> tags define run-time settings for the object.
Important: Do not use the <object> tag for images, use the <img> tag instead!

Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
align left
Defines the text alignment around the object TF
archive URL A space separated list of URL's to archives. The archives contains resources relevant to the object STF
border pixels Defines a border around the object TF
classid class ID Defines a class ID value as set in the Windows Registry or a URL STF
codebase URL Defines where to find the code for the object STF
codetype MIME type The internet media type of the code referred to by the classid attribute STF
data URL Defines a URL that refers to the object's data STF
declare declare Defines that the object should only be declared, not created or instantiated until needed STF
height pixels Defines the height of the object STF
hspace pixels Defines the horizontal spacing around the object TF
name unique_name Defines a unique name for the object (to use in scripts) STF
standby text Defines a text to display while the object is loading STF
type MIME_type Defines the MIME type of data specified in the data attribute STF
usemap URL Specifies a URL of a client-side image map to be used with the object STF
vspace pixels Defines the vertical spacing around the object TF
width pixels Defines the width of the object STF

Standard Attributes

id, class, title, style, dir, lang, xml:lang, accesskey, tabindex

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
HTML Object tag Reviewed by 1000sourcecodes on 21:56 Rating: 5
Powered by Blogger.