NOTE : The <OBJECT>
element is currently only supported by Internet Explorer. The object insertion mechanism is the subject of a W3C Working draft available at http://www.w3.org/pub/WWW/TR/WD-object.html. For this and other W3C working drafts, you should visit the W3C site at http://www.w3.org/pub/WWW/TR/
The <OBJECT>
element provides a way for the ActiveX controls and other media to be embedded directly into HTML documents. It subsumes the role of the <IMG>
element, providing an insertion mechanism for media other than static images. As far as the Internet Explorer is concerned, the <OBJECT>
element can be used for the inclusion of ActiveX OLE controls.
An example of the syntax is as follows:
|
The object being inserted into the HTML document in this case, is referred to by it's CLASSID. This is a unique identifier for the 'label' control, according to the Component Object Model "class id" URL scheme. The ID attribute identifies the specific label with a unique name, allowing interaction with and dynamic updating of the object's properties via active OLE scripting (i.e. Visual Basic Script).
Where the ActiveX control that is to be inserted may not be present on the users system, the automatic download mechanism of ActiveX controls (using the CODEBASE attribute) can be employed. This attribute can be used to provide a location from which the control will be downloaded.
For example :
<OBJECT CLASSID="clsid:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"
CODEBASE=http://www.mysite.com/controls/mycontrol.ocx
ID=lbl1
WIDTH=90
...
would look within the system registry to see if the control with the given CLASSID
is present on the system and if not, the control will be retrieved from the URL given by the CODEBASE
attribute. Full version checking can also be employed using this mechanism.
For example :
<OBJECT CLASSID="clsid:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"
CODEBASE=http://www.mysite.com/controls/mycontrol.ocx#ver=3,10,0,1000"
ID=lbl1
WIDTH=90
...
would only download the control to the users system if the version present on the system is older than that given by the #ver
setting. I.e. if it is older than version 3.10.0.1000.
Some objects will require certain code to implement the object. This should be referenced by using the CODE attribute. Also, the DATA attribute can be used to point to a persistent data stream to initialise the object's state. The use of the above attributes is control dependant, so exhaustive examples cannot be given.
In keeping with the role of the <OBJECT>
element as a media insertion element (c.f. <IMG>
) various standard formatting attributes, such as HEIGHT, WIDTH, ALIGN, BORDER, HSPACE, VSPACE etc. can also be used to define the positioning of the object on the page.
The <PARAM> element allows a list of named property values (used to initialise an OLE control, plug-in module or Java applet) to be represented as a sequence of <PARAM>
elements. Note that <PARAM>
is an empty element and should appear without an end tag. The NAME attribute defines the property to be defined and the VALUE attribute defines the property value. For instance, in the above example, the line:
<PARAM NAME="caption" VALUE="Hello there">
sets the value of the property 'Caption' to be "Hello there" (In this case, this property represents the text that will be displayed for the label.) Object properties are entirely control dependant, so the reference documentation for any control should be read to find out what properties can be set using the PARAM
element.
Microsoft recently released the ActiveX Control Pad, a text editor with added <OBJECT>
insertion capabilities. Using this, authoring HTML documents that contain ActiveX components is a breeze, as control insertion/property setting is done through a Visual Basic like forms interface (the ActiveX Control Pad has been jokingly referred to as Visual Notepad). The Control Pad also allows authoring of fixed-layout sections, viewable using the ActiveX HTML Layout Control (available from Microsoft). This allows for presentation of fixed content, where the content will display as authored (something which can't be guaranteed with normal HTML). Users interested in authoring 'Activated' HTML documents, then download the ActiveX Control Pad from the Microsoft Web site at http://www.microsoft.com/workshop/author/cpad/.