w3schools    w3Schools
Search :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
ASP Tutorial
ASP HOME
ASP Introduction
ASP Install
ASP Syntax
ASP Variables
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail

ASP Objects
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error

ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO

ASP Components
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator

ASP Quick Ref
ASP Summary

Examples/Quiz
ASP Examples
ASP Quiz
ASP Exam

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

Browse Tutorials
 

ASP Variables

previous next

A variable is used to store information.

If the variable is declared outside a procedure it can be changed by any script in the ASP file. If the variable is declared inside a procedure, it is created and destroyed every time the procedure is executed.


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 headers
How to loop through the six headers 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 a specific application.


previous next