tadam logo

<object>

HTML <object> Tag

Example

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" />
</object>
The output of the code above will be:

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

NONE

Tips and Notes

Note: The <param> tag 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 HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
AttributeValueDescriptionDTD
alignleft
right
top
bottom
Defines the text alignment around the objectTF
archiveURLA space separated list of URL's to archives. The archives contains resources relevant to the objectSTF
borderpixelsDefines a border around the objectTF
classidclass_IDDefines a class ID value as set in the Windows Registry or a URLSTF
codebaseURLDefines where to find the code for the objectSTF
codetypeMIME_typeThe internet media type of the code referred to by the classid attributeSTF
dataURLDefines a URL that refers to the object's dataSTF
declaredeclareDefines that the object should only be declared, not created or instantiated until neededSTF
heightpixelsDefines the height of the objectSTF
hspacepixelsDefines the horizontal spacing around the objectTF
namenameDefines the name for an object (to use in scripts)STF
standbytextDefines a text to display while the object is loadingSTF
typeMIME_typeDefines the MIME type of data specified in the data attributeSTF
usemapURLSpecifies a URL of a client-side image map to be used with the objectSTF
vspacepixelsDefines the vertical spacing around the objectTF
widthpixelsDefines the width of the objectSTF

Standard Attributes

Тег <object> поддерживает следующие стандартные атрибуты:
AttributeValueDescriptionDTD
classclassnameSpecifies a classname for an elementSTF
dirrtl
ltr
Specifies the text direction for the content in an elementSTF
ididSpecifies a unique id for an elementSTF
langlanguage_codeSpecifies a language code for the content in an elementSTF
stylestyle_definitionSpecifies an inline style for an elementSTF
tabindexnumberSpecifies the tab order of an elementSTF
titletextSpecifies extra information about an elementSTF
xml:langlanguage_codeSpecifies a language code for the content in an element, in XHTML documentsSTF
More information about Standard Attributes.

Event Attributes

The <object> tag supports the following event attributes:
AttributeValueDescriptionDTD
onclickscriptScript to be run on a mouse clickSTF
ondblclickscriptScript to be run on a mouse double-clickSTF
onmousedownscriptScript to be run when mouse button is pressedSTF
onmousemovescriptScript to be run when mouse pointer movesSTF
onmouseoutscriptScript to be run when mouse pointer moves out of an elementSTF
onmouseoverscriptScript to be run when mouse pointer moves over an elementSTF
onmouseupscriptScript to be run when mouse button is releasedSTF
onkeydownscriptScript to be run when a key is pressedSTF
onkeypressscriptScript to be run when a key is pressed and releasedSTF
onkeyupscriptScript to be run when a key is releasedSTF

More information about Event Attributes.

Was this information helpful?
   

Comments