Working with objects in VBScript
Working with objects
Microsoft Visual Basic Scripting Edition and Microsoft (r) Internet Explorer, whether you are using an ActiveX control (formerly known as an OLE control) or a Java (TM) object are treated in the same way. If you are using Internet Explorer and you have a Label control installed, you will see a page made from the following code.
The <OBJECT> tag is used to contain the initial value of the object,
<OBJECT
classid="clsid:99B42120-6EC7-11CF-A6C7-00AA00A47DD2"
id=lblActiveLbl
width=250
height=250
align=left
hspace=20
vspace=0
>
<PARAM NAME="Angle" VALUE="90">
<PARAM NAME="Alignment" VALUE="4">
<PARAM NAME="BackStyle" VALUE="0">
<PARAM NAME="Caption" VALUE="
A simple tag ">
<PARAM NAME="FontName" VALUE="
song body">
<PARAM NAME="FontSize" VALUE="20">
<PARAM NAME="FontBold" VALUE="1">
<PARAM NAME="FrColor" VALUE="0">
</OBJECT>
As with any form control, you can get properties, set properties, and Invoke methods. For example, the following code contains a <FORM> control that can be used to manipulate two properties of a Label control:
<FORM NAME="LabelControls"><INPUT TYPE="TEXT" NAME="txtNewText" class='9v'5><INPUT TYPE="BUTTON" NAME="cmdChangeIt" VALUE="
Change the text ">
<INPUT TYPE="BUTTON" NAME="cmdRotate" VALUE="
rotation label">
</FORM>
The Cmdchangeit button's event procedure can change the label text through a defined form:
<SCRIPT LANGUAGE="VBScript"><!--Sub cmdChangeIt_onClick
Dim TheForm
Set TheForm = Document.LabelControls
lblActiveLbl.Caption = TheForm.txtNewText.Value
End Sub
-->
</SCRIPT>
The code limits the references to controls and values to the form, similar to the code in the simple validation example.
Multiple ActiveX controls are available for Internet Explorer. You can find all the information about properties, methods and events, and the control class name identifier (CLSID) on the Microsoft (R) Web site (http://www.microsoft.com). You can also find more information on <OBJECT> tags on Internet Explorer 4.0 Author's Guide and HTML reference pages.
note Earlier versions of the internet Explorer require braces ({}) to enclose the ClassID attribute, which does not conform to the requirements of the wide-format consortium. Using curly braces in the current version results in the "<OBJECT> tag with outdated versions of this page" information.