VBS TUTORIAL: Using Object _vbs in VBScript

Source: Internet
Author: User

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,

<OBJECTclassid="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_onClickDim TheForm   Set TheForm = Document.LabelControlslblActiveLbl.Caption = TheForm.txtNewText.ValueEnd 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.