ASP Introductory Tutorials-vbscript Overview

Source: Internet
Author: User
Tags html page script tag

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

Related Article

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.