|
Visual Basic for Applications Unleashed
Chapter 21Web Page Programming: ActiveX and VBScript
ActiveX: The <OBJECT> TagAs with anything else you insert into a Web page, ActiveX controls are defined via HTML tags. In this case, the basic container tags for an ActiveX control are <OBJECT> and </OBJECT>. The <OBJECT> tag has quite a few attributes that control various aspects of the object, including the type of object, its location, the height and width, and more. Some of these attributes are listed in Table 21.1.Table 21.1. A few attributes of the <OBJECT> tag.
For registered ActiveX controls, the syntax of the CLASSID attribute is as follows: CLSID:class-identifier Here, class-identifier is the object's CLSID as found in the Registry. To insert an ActiveMovie control object, for example, you could use the following <OBJECT> tag:
<OBJECT
ID="ActiveMovie1"
WIDTH=200
HEIGHT=100
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
Most ActiveX objects also have a selection of properties. An ActiveMovie object, for example, has a FileName property that you can use to specify a video clip file. To set an object's properties, you include one or more <PARAM> tags between the <OBJECT> and </OBJECT> tags. For each <PARAM> tag, you specify a NAME attribute and a VALUE attribute. For example, the following sequence of tags defines an ActiveMovie object and sets its FileName property to MyMovie.avi:
<OBJECT
ID="ActiveMovie1"
WIDTH=200
HEIGHT=100
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A">
<PARAM NAME="FileName" VALUE="MyMovie.avi">
</OBJECT>
Many ActiveX controls have quite a few properties, so your <OBJECT> definitions can get quite long. Here's some code that defines a Marquee (scrolling text) object:
<OBJECT
ID="marquee1"
ALIGN=CENTER
CLASSID="clsid:1a4da210-2117-11cf-be21-0080c72edd2d"
WIDTH=200
HEIGHT=200>
<PARAM NAME="ScrollStyleX" VALUE="Circular">
<PARAM NAME="ScrollStyleY" VALUE="Circular">
<PARAM NAME="szURL" VALUE="marqcont.htm">
<PARAM NAME="ScrollDelay" VALUE=60>
<PARAM NAME="LoopsX" VALUE=-1>
<PARAM NAME="LoopsY" VALUE=-1>
<PARAM NAME="ScrollPixelsX" VALUE=0>
<PARAM NAME="ScrollPixelsY" VALUE=-3>
<PARAM NAME="DrawImmediately" VALUE=0>
<PARAM NAME="Whitespace" VALUE=0>
<PARAM NAME="PageFlippingOn" VALUE=0>
<PARAM NAME="Zoom" VALUE=100>
<PARAM NAME="WidthOfPage" VALUE=400>
</OBJECT>
Copyright © 1995-2008 Paul McFedries and Logophilia Limited | ||||||||||||||||||||||||||||||||||||||||||||