1, VBScript Introduction
VBScript is a scripting language and the default language for ASP, which allows you to embed a VBScript script directly in an HTML file to extend HTML so that it is more than just a page format language. Web pages with VBScript scripts can respond to user actions.
2. Add VBScript code to HTML page
The Vbsript script exists as part of a page in an HTML document. That is, the code must be placed in an HTML document to execute. The script code can be placed anywhere in the HTML document, which is the body or head section. Typically, the script code is centrally placed in the head section, which ensures that all script code is read and decoded before the code is invoked in the body section.
When you add VBScript scripting code to an HTML page, you should start with a <script> tag and end with a </script> tag. The basic syntax format is as follows:
<script Languge="脚本语言名称" [event="事件名称"] [For="对象名称"]>
<!--
脚本代码
-->
</script>
The script tag has the following 3 properties.
(1) Language: Specifies the scripting language used by the scripting code. For Internet Explorer browsers, this property can be taken as "Vbscrip" or "JScript", which can be abbreviated to "VBS".
(2) Event: Specifies the events associated with the scripting code.
(3) For: Specifies the object to associate with the event.
In the syntax above, the scripting code is embedded between the annotation tag <!--and--> to avoid the browser that does not recognize the script tag from displaying the code in the page.
Attention
The script tag can appear any time in the head and body parts of an HTML document.
Most scripting code is placed in a sub or functip procedure that executes only once when an HTML page is loaded and can initialize data or dynamically alter the appearance of the page when the Web page is loaded.
See the full set of ASP Getting started tutorials