|
|||
|
An ActiveX control is inserted into an HTML page by using the <OBJECT>tag, followed by the <CLASSID> tag and the CLSID number: <OBJECT ID="pmenu1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:52DFAE60-CEBF-11CF-A3A9-00A0C9034920"> Initial parameters are set before the CLSID number, along with an <ID> tag that sets the size and gives the control a name (ID). Control of the OCX is managed by using the ID. The HEIGHT and WIDTH properties of the ActiveX control set a rectangle in which visual controls are displayed. Placement of the control on the Web page is dependent on HTML formatting. You can set the property values for the object by using the <param> tag inside the <OBJECT><</OBJECT> pair. However, many properties of AxtiveX controls are unique, and one should examine them before using ActiveX control. In the below example, the angle and BackStyle properties of the Label control are set : <param name="angle" value="90"> <param name="BackStyle" value="0"> ActiveX controls are programmed just like any other object on the Web page. You set the properties of the control, and then your script reacts to messages sent by the user interacting with the objects in the browser. Because this is happening mostly on the client machine, the speed of the operation is limited only by the client's hardware. Each ActiveX control has a set of properties and actions that can be set and reacted to. Suppose that you use the Label control to create some text on your page. You might set up the label like this: <OBJECT ID="Label1" WIDTH=104 HEIGHT=27 CLASSID="CLSID:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"> <PARAM NAME="_ExtentX" VALUE="2752"> <PARAM NAME="_ExtentY" VALUE="714"> <PARAM NAME="Caption" VALUE="Label Control"> </OBJECT> You then can respond to the Click event in your code: Sub Label1_Click() Dim a a = Label1.Caption If a = "Start" Then a = "Stop" Else a = "Start" End If Label1.Caption = a End Sub In this example, you can see that an ActiveX object works and behaves just like any VBScript intrinsic control. This is one of the great benefits of using ActiveX controls in Web pages. The broad base of current custom control developers will eventually make it very easy to find just the control you need for your particular purpose. If you're using a particularly popular control, such as one of the Microsoft controls discussed in this chapter, the user might already have the control installed on his or her system. The use of such controls is then seamless to the user. In general, most ActiveX custom controls will have to be downloaded and installed on the user's machine before they can be viewed in the user's browser. ActiveX controls are Go To Page: 1 2
The copyright of the article Inserting ActiveX Controls in the Web Page in VB Script is owned by . Permission to republish Inserting ActiveX Controls in the Web Page in print or online must be granted by the author in writing.
For a complete listing of article comments, questions, and other discussions related to Maxim Karetnikov's VB Script topic, please visit the Discussions page. |
|||
|
|
|||
|
|
|||