W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0y
4.0y
TV 1.2n
2.1n

<OBJECT>...</OBJECT>

Description

The object element allows the author to embed an object into the document. This element also replaces the APPLET element.

Parameters can be passed to the object by using the PARAM element. These parameters must be placed at the start of the content inside the object element.

Inside the element you can put content that will be rendered as an alternative, when the browser cannot render the object itself. Note that this alternative content may also contain an object. When the browser is able to render the object, the contents are neglected, except for the PARAM elements.

The object element can be used in the body of the document, and in the head. When used in the head, the object must not contain any content, because content inside the head isn't supposed to be rendered inside the document. Placing an object in the head of a document can be used to make sharing of data between pages possible. To do this, create an object in a frameset-page, and all pages in that frameset can access that object.

When inside a FORM, the value of the object can be part of the form. The value of the object is determined by the object's implementation.

You can separate the object declaration and the instantiation. There are three instances when this is useful:

  1. When an object is used more than once in a document it can be declared once and instantiated each time it is needed, with the advantage that the object can be reused.
  2. You can instantiate the object from another location than the declaration, like the reaction to a link.
  3. You can create objects that can be used as run-time data for other objects.
To declare an object, use the declare attribute, and give the object an id that can be used for the instantiation.
The declaration of the object must appear before the first instance.

DTD

<!ELEMENT OBJECT - - (PARAM | %flow;)*
 -- generic embedded object -->
<!ATTLIST OBJECT
  %attrs;                              -- %coreattrs, %i18n, %events --
  declare     (declare)      #IMPLIED  -- declare but don't instantiate flag --
  classid     %URI;          #IMPLIED  -- identifies an implementation --
  codebase    %URI;          #IMPLIED  -- base URI for classid, data, archive--
  data        %URI;          #IMPLIED  -- reference to object's data --
  type        %ContentType;  #IMPLIED  -- content type for data --
  codetype    %ContentType;  #IMPLIED  -- content type for code --
  archive     %URI;          #IMPLIED  -- space separated archive list --
  standby     %Text;         #IMPLIED  -- message to show while loading --
  height      %Length;       #IMPLIED  -- override height --
  width       %Length;       #IMPLIED  -- override width --
  usemap      %URI;          #IMPLIED  -- use client-side image map --
  name        CDATA          #IMPLIED  -- submit as part of form --
  tabindex    NUMBER         #IMPLIED  -- position in tabbing order --
  >
from the HTML 4.0 DTD, "Copyright © W3C, (MIT, INRIA, Keio). All Rights Reserved."

Attributes

Core attributes: class id style title
Internationalization attributes: dir lang
Events: onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup

W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0n
4.0n
TV 1.2n
2.1n
ALIGN
This attribute defines how the object is positioned on the page. The values work the same way as the values of the IMG element.

Value Description
ABSBOTTOM Aligns the bottom of the object with the lowest item in the line.
ABSMIDDLE Aligns the middle of the object with the middle of the line.
BASELINE Aligns the bottom of the object with the baseline of the text in the line. This result is the same as align="bottom".
BOTTOM Aligns the bottom of the object with the baseline of the text in the line. This result is the same as align="baseline".
CENTER Aligns the middle of the object with the baseline of the text. This result is the same as align="middle".
LEFT Places the object at the left margin of the page.
MIDDLE Aligns the middle of the object with the baseline of the text. This result is the same as align="center".
RIGHT Places the object at the right margin of the page.
TEXTTOP Aligns the top of the object with the top of the text in the line.
TOP Aligns the top of the object with the top of the largest item in the line.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
ARCHIVE
This attribute may be used to specify a space-separated list of URIs for archives containing resources relevant to the object, which may include the resources specified by the classid and data attributes. Preloading archives will generally result in reduced load times for objects. Archives specified as relative URIs should be interpreted relative to the codebase attribute.
CLASSID
This attribute may be used to specify the location of an object's implementation via a URI. It may be used together with, or as an alternative to the data attribute, depending on the type of object involved.
W3 3.2n
4.0y
NS 3.0n
4.0y
IE 3.0n
4.0y
TV 1.2n
2.1n
CODEBASE
This attribute specifies the base path used to resolve relative URIs specified by the classid, data, and archive attributes. When absent, its default value is the base URI of the current document.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
CODETYPE
This attribute specifies the content type of data expected when downloading the object specified by classid. This attribute is optional but recommended when classid is specified since it allows the user agent to avoid loading information for unsupported content types. When absent, it defaults to the value of the type attribute.
W3 3.2n
4.0y
NS 3.0n
4.0y
IE 3.0n
4.0y
TV 1.2n
2.1n
DATA
This attribute may be used to specify the location of the object's data, for instance image data for objects defining images, or more generally, a serialized form of an object which can be used to recreate it. If given as a relative URI, it should be interpreted relative to the codebase attribute.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
DECLARE
When present, this boolean attribute makes the current OBJECT definition a declaration only. The object must be instantiated by a subsequent OBJECT definition referring to this declaration.
W3 3.2n
4.0y
NS 3.0n
4.0y
IE 3.0n
4.0y
TV 1.2n
2.1n
HEIGHT
The height of the area that will be available to the object. This value can be a number of pixels, or a percentage.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
NAME
The name of the object, by which it can be referenced by scripts.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
STANDBY
This attribute specifies a message that a user agent may render while loading the object's implementation and data.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
TABINDEX
Description of the TABINDEX attribute
W3 3.2n
4.0y
NS 3.0n
4.0y
IE 3.0n
4.0y
TV 1.2n
2.1n
TYPE
This attribute specifies the content type for the data specified by data. This attribute is optional but recommended when data is specified since it allows the user agent to avoid loading information for unsupported content types.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
USEMAP
When this attribute is used, it is implied that the included object is an image, and is used to implement a client-side imagemap.
W3 3.2n
4.0y
NS 3.0n
4.0y
IE 3.0n
4.0y
TV 1.2n
2.1n
WIDTH
The width of the area that will be available to the object. This value can be a number of pixels, or a percentage.

Examples

Source
<OBJECT classid="java:APPLET1.class" width="200" height="50">
<PARAM name="text" value"Java applet through an OBJECT element">
A Java applet
</OBJECT>
 
Result
A Java applet
 
Source
<OBJECT data="danger.wav">Danger!</OBJECT>
 
Result
Danger!
Statistics