ASP Variables

2012 年 9 月 20 日7350

ASP Variables

« Previous

Next Chapter »


A variable is used to store information.


Examples

Try it Yourself - Examples

Declare a variable
Variables are used to store information. This example demonstrates how to declare a variable, assign a value to it, and use the value in a text.

Declare an array
Arrays are used to store a series of related data items. This example demonstrates how to declare an array that stores names.

Loop through the HTML headings
How to loop through the six headings in HTML.

Time-based greeting using VBScript
This example will display a different message to the user depending on the time on the server.

Time-based greeting using JavaScript
This example is the same as the one above, but the syntax is different.


Lifetime of Variables

A variable declared outside a procedure can be accessed and changed by any script in the ASP file.

A variable declared inside a procedure is created and destroyed every time the procedure is executed. No scripts outside the procedure can access or change the variable.

To declare variables accessible to more than one ASP file, declare them as session variables or application variables.

Session Variables

Session variables are used to store information about ONE single user, and are available to all pages in one application. Typically information stored in session variables are name, id, and preferences.

Application Variables

Application variables are also available to all pages in one application. Application variables are used to store information about ALL users in one specific application.

« Previous

Next Chapter »



W3Schools Certification

W3Schools' Online Certification

The perfect solution for professionals who need to balance work, family, and career building.

More than 10 000 certificates already issued!

Get Your Certificate »

The HTML Certificate documents your knowledge of HTML.

The CSS Certificate documents your knowledge of advanced CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The jQuery Certificate documents your knowledge of jQuery.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

Your suggestion:

Close [X]

Thank you for your support.

Close [X]

0 0