The Internet Explorer supports a set of controls that are built into the browser itself. These controls, called intrinsic HTML controls, do not have to be downloaded across the Internet to be used on the client machine. Intrinsic controls are not defined with the <OBJECT></OBJECT> tags, as ActiveX controls are. Instead, they are defined either with the <INPUT> tag or such special tags as the <SELECT></SELECT> tags or <TEXTAREA></TEXTAREA> tags. The intrinsic controls are used with these tags because these tags support the original HTML specification for controls on a web page. Prior to the introduction of ActiveX controls and downloadable objects, HTML supported several controls through these special HTML tags. For example, inserting a button into a web page is done with the <INPUT> tag, as shown here:
<INPUT TYPE="BUTTON" NAME="Command1">
The intrinsic controls are often used in conjunction with an HTML form. Forms are created with the <FORM></FORM> tags. Controls are subsequently defined inside the form. The following code defines two text fields and a button inside a form:
<FORM NAME="frmOne">
<INPUT TYPE="TEXT" NAME="Text1">
<INPUT TYPE="TEXT" NAME="Text2"><BR>
<INPUT TYPE="BUTTON" NAME="Command1">
</FORM>
When controls are defined inside a form, the Internet Explorer automatically supports their events in VBScript code. In the above case, the button supports an OnClick event that the Internet Explorer will fire, executing code in a VBScript event-handling subroutine, shown here:
<SCRIPT LANGUAGE="VBScript">
Sub Command1_OnClick
MsgBox "Event Routine Fired!"
End Sub
</SCRIPT>
Notice that the name of the event-handling subroutine is OnClick. This initially looks strange to developers who are familiar with Visual Basic for Applications syntax. In Visual Basic, for example, the event-handling subroutine for a pressed button is called Click. Why the difference? Isn't VBScript a proper subset of Visual Basic for Applications? The answer rests in the fact that intrinsic HTML controls existed before VBScript, so the Internet Explorer supports them for backward compatibility. The OnClick event is defined in the HTML standard, not in Visual Basic for Applications. Click events are supported for ActiveX components that are downloaded with the <OBJECT>
</OBJECT> tags. Table 3-15 lists the properties, events, and methods for the intrinsic HTML controls.
Table 3-15.Intrinsic HTML Controls
Intrinsic HTML Control | Properties | Events | Methods |
Button | Form, Enabled Name Value | OnClick OnFocus | Click Focus |
CheckBox | Form, Enabled Name Value Checked DefaultChecked | OnClick OnFocus | Click Focus |
Hidden | Name Value | ||
Password | Form, Enabled Name Value DefaultValue | OnFocus OnBlur | Focus Blur Select |
Radio | Form, Enabled Name Value Checked | OnClick OnFocus | Click Focus |
Reset | Form, Enabled Name Value | OnClick OnFocus | Click Focus |
Select | Name Length Options SelectedIndex | OnFocus OnBlur OnChange | Focus Blur |
Submit | Form, Enabled Name Value | OnClick OnFocus | Click Focus |
Text TextArea | Form, Enabled Name Value DefaultValue | OnFocus OnBlur OnChange OnSelect | Focus Blur Select |
KEY CONCEPT: Intrinsic HTML controls exist to support the original use of controls in HTML. Intrinsic HTML controls are part of the Internet Explorer architecture.
Although the intrinsic HTML controls support ActiveX concepts such as properties, events, and methods, they are typically defined with standard HTML syntax. Therefore, the rest of this chapter provides an explanation of each control for the Visual Basic for Applications developer not intimately familiar with HTML syntax.