Variables used in ASP to store information

Source: Internet
Author: User

If you declare a variable outside of a subroutine, that variable can be changed by any script in the ASP file. If a variable is declared in the subroutine

Order, it is created and revoked every time the subroutine executes.

Instance: the

Declaration variable

variable is used to store information. This example shows how to declare a variable, assign a value to a variable, and use the variable

Declaration array

Array in a program to store a series of related data items. This example shows how to declare an array that stores a name. The

Loop generates an HTML caption

To loop through the generation of 6 different HTML headings.

Using Vbscript to make a time-based greeting

This example displays different messages to the user based on the server time.

Use JavaScript to make time-based greetings

In this case, it's just a different syntax. Variable lifetime

Variables declared outside the subroutine can be accessed and modified by any script in the ASP file. A variable declared in a subroutine by

is created and revoked only when the subroutine is executed every time. Scripts outside the subroutine cannot access and modify the variable

. Changchun Male Hospital

If you want to declare variables for use by multiple ASP files, declare the variables as session variables or application

variables. The

session Variable

Session variable is used to store information for a single user and is valid for all pages in an application. Typical data that stores

In a session is a name, ID, or parameter. The

application variable

Application variable is also valid for all pages in an application. The application variable is used to store information for all users in a specific application in

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.