In this article we will look at a sample chapter from Wrox's HTML 4.01 Programmer's Reference book. This chapter focuses on the HTML object tag and shows a variety of advanced ways to use and manipulate it.
Sample Chapter: HTML 4.01 Programmers Reference - Internet Explorer (Page 5 of 10 )
Internet Explorer adds other attributes to the <object> element:
Note: only the align attribute is actually supported in IE 5.5 onwards, the rest are IE 4 only. Now let's look at these in turn:
align The syntax for the align attribute in this context is slightly different from normal: align="top | middle | bottom | left | right | absbottom* | texttop* | absmiddle* | baseline*"
* For explanations of these values, please refer back to Chapter 5, and look at the section on the <img> element. This attribute is deprecated in HTML 4.01.
accesskey This attribute defines the "hot-key" that can be used to activate the element, or switch the input focus to it. This is used where a hyperlink takes the form of an image, rather than a text string. For details of using an image as a hyperlink see Chapter 4. For more about the uses of the accesskey attribute, see Chapter 6.
alt This defines a text alternative to the graphic. See Chapter 5 for more details.
code This attribute defines the URL to the Java class file implementing the object, if this is the object source instead of an image. Its syntax is:
datafld and datasrc These attributes are used to connect the <object> element to a client-side cached data source in Internet Explorer 4, in a technique called data binding. These have since been removed in Internet Explorer 6. For a look at using these attributes, see the "<frame>" section of Chapter 8.
hidefocus This attribute holds a value indicating whether or not the object is indicated visibly when the element is in focus. See Chapter 8 for more information.
notab This attribute was present very briefly in Internet Explorer 3, but was dropped by the time of version 4. It was used to exclude an element from the tabbing order, but now this can be achieved by setting the tabindex attribute to –1.
type This attribute defines the MIME type for the object, as defined in the registry on a Windows Machine. The syntax is:
where mime-type is a unique text string of a standard format, which tells the browser what kind of information the file contains, and which application to use to read or execute it – as appropriate. The MIME-types for popular image formats are "image/gif", "image/jpeg", and "image/png". This is overridden by the classid attribute.
unselectable This attribute specifies that the element cannot be selected. The syntax is:
unselectable="on | off"
If it is set to off (the default), then the element can be selected. Setting it to on makes the object unselectable.
Tags <object> Can Enclose The <object> element operates in conjunction with the <param> element, which is used to specify the different parameters that each object can take. These parameters are values that the object will require at run time. They must be placed at the beginning of the content of the <object> element.
The <param> Element The param element can take the following attributes:
plus the universal attributes and core events discussed in Chapter 2. The majority of these additional elements, which are specific to a particular object, will just use a name and a value.
name This attribute specifies the name or property of the parameter. This attribute is mandatory for every <param> element. The syntax is:
value his attribute specifies the value to set for the parameter. The syntax is:
type This attribute has the value of the MIME type that is retrieved if valuetype (the data type of the value attribute) is set to ref. The syntax is:
valuetype This attribute specifies how the parameter value will be obtained. The syntax is:
valuetype="data | ref | object"
ref is via a URL, while data is the default, an implicit value, and object is an identifier that refers to the id of another object defined in the page. IE 6 is the first IE version to support valuetype for the <param> element.