<object> (Embedded Object)
This element specifies an arbitrary object to be included in an HTML document. Initially, this element was used to insert ActiveX controls, but according to the specification, an object can be any media object, document, applet, ActiveX control, or even image.
align="bottom | left | middle | right | top" (transitional only)</object>
border="percentage | pixels" (transitional only)
data="URL of data"
dir="ltr | rtl"
height="percentage | pixels"
hspace="percentage | pixels" (transitional only)
id="unique alphanumeric identifier"
name="unique alphanumeric name"
standby="standby text string"
vspace="percentage | pixels" (transitional only)
width="percentage | pixels"
param elements and alternative rendering
Attributes Defined by Internet Explorer
align="absbottom | absmiddle | baseline | texttop"(4)
datasrc="id for bound data"(4)
unselectable="on | off"(5.5)
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Events Defined by Internet Explorer
onactivate, onbeforedeactivate, onbeforeeditfocus, onblur, oncellchange, oncontrolselect, ondataavailable, ondatasetchanged, ondatasetcomplete, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onlosecapture, onmove, onmoveend, onmovestart, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onrowenter, onrowexit, onrowsdelete, onrowsinserted, onscroll, onselectstart
Element Specific Attributes
- This attribute aligns the object with respect to the surrounding text. The default is left. The HTML specification defines bottom, middle, right, and top, as well. Browsers might provide an even richer set of alignment values. The behavior of alignment for objects is similar to images. Under the strict HTML and XHTML specifications, the object element does not support this attribute.
- This attribute contains a URL for the location of an archive file. An archive file typically is used to contain multiple object files to improve the efficiency of access.
- This attribute specifies the width of the object's borders in pixels or as a percentage.
- This attribute contains a URL for an object's implementation. The URL syntax depends upon the object's type. With ActiveX controls, the value of this attribute does not appear to be a URL but something of the form CLSID: object-id; for example, CLSID: 99B42120-6EC7-11CF-A6C7-00AA00A47DD2.
- Under the old Microsoft implementation, this attribute contains the URL referencing a Java applet class file. The way to access a Java applet under the HTML/XHTML specification is to use <object classid="java: classname.class">. The pseudo-URL java: is used to indicate a Java applet. Microsoft Internet Explorer 4 and beyond support this style, so code should not be used.
- This attribute contains a URL to use as a relative base to access the object specified by the classid attribute.
- This attribute specifies an object's MIME type. Do not confuse this attribute with type, which specifies the MIME type of the data the object may use, as defined by the data attribute.
- This attribute contains a URL for data required by an object.
- This Microsoft-specific attribute is used to indicate the column name in the data source that is bound to the object element.
- The value of this Microsoft-specific attribute is set to an identifier indicating the data source to pull data from.
- This attribute declares an object without instantiating it. This is useful when the object will be a parameter to another object. In traditional HTML, this attribute takes no value; under XHTML, set it equal to declare.
- This attribute specifies the height of the object in pixels or as a percentage of the enclosing window.
- This attribute indicates the horizontal space, in pixels or percentages, between the object and surrounding content.
- Under the Microsoft definition, this attribute defines the name of the control so scripting can access it. Older HTML specifications suggest that it is a name for form submission, but this meaning is unclear and not supported by browsers.
- This attribute contains a text message to be displayed while the object is loading.
- This attribute takes a numeric value indicating the position of the object in the tabbing index for the document. Tabbing proceeds from the lowest positive tabindex value to the highest. Negative values for tabindex will leave the object out of the tabbing order. When tabbing is not explicitly set, the browser can tab through items in the order they are encountered.
- This attribute specifies the MIME type for the object's data. This is different from the codetype, which is the MIME type of the object and not of the data it uses.
- This attribute contains the URL of the image map to be used with the object. Typically, the URL will be a fragment identifier referencing a map element somewhere else within the file. The presence of this attribute indicates that the type of object being included is an image.
- This attribute indicates the vertical space, in pixels or percentages, between the object and surrounding text.
- This attribute specifies the width of the object in pixels or as a percentage of the enclosing window or block element.
<object id="IeLabel1" width="325" height="65"
<param name="_ExtentX" value="6879" />
<param name ="_ExtentY" value="1376" />
<param name="Caption" value="Hello World" />
<param name="Alignment" value="4" />
<param name="Mode" value="1" />
<param name="ForeColor" value="#FF0000" />
<param name="FontName" value="Arial" />
<param name="Fontize" value="36" />
<b>Hello World for non-ActiveX users!</b>
<object classid="java:Blink.class" standby="Here it comes"
height="100" width="300"> <param name="lbl"
value="Java is fun, exciting, and new.">
<param name="speed" value="2">
This will display in non-Java-aware or -enabled browsers.
Data not included!
<object data ="pullinthisfile.html">
Data not included!
HTML 4, 4.01
XHTML 1.0, 1.1, Basic
Internet Explorer 3, 4, 5, 5.5, 6
Netscape 4, 4.5 4.8, 6, 7
Opera 4 7
Under the strict HTML and XHTML specifications, the object element loses most of its presentation attributes, including align, border, height, hspace, vspace, and width. These attributes are replaced by style sheet rules.
The HTML 4.01 specification reserves the datafld, dataformatas, and datasrc attributes for future use. However, these attributes were dropped in XHTML, though they are well supported by Internet Explorer 4 and beyond.
Alternative content should be defined within an <object> tag after any enclosed <param> tags.
The object element is still mainly used to include multimedia binaries in pages. Although the specification defines that it can load in HTML files and create image maps, not every browser supports this, and few developers are aware of these features. In theory, this very versatile tag should take over duties from the venerable <img> tag in future XHTML specifications.
See Chapter 15 for specific examples of object and an expanded discussion.