ASP and VBScript Examples
ASP Output
Writing plain text
Writing HTML Tags
Writing HTML attributes
VbScript Variables
Create a variable
Create a variable
and change its value
Insert a variable value in a text
Create an array
VBScript Looping
For..Next loop
Looping through HTML headers
For..Each loop
Do...While loop
VBScript Date and Time Functions
Date and time
Get the name of a day
Get the name of a month
Get todays' day and month
Countdown to year 3000
Calculate the day which is n days from today
Format date and time
Is this a date?
Some Other Built-in VBScript Functions
Uppercase or lowercase a string
Trim a string
How to reverse a string?
How to round a number?
A random number
Return a random number between 0-99
Return a specified number of characters from left/right of a string
Replace some characters in a string
Return a specified number of characters from a string
Procedures
Sub procedure
Function procedure
VBScript vs JavaScript
Call a procedure using VBScript in ASP
Call a procedure using JavaScript in ASP
Call a JavaScript procedure and a VBScript procedure using VBScript in ASP
Time-based greeting using VBScript
Time-based greeting using JavaScript
VBScript Conditional Statements
If...Then..Else statement
If...Then..ElseIf statement
Select Case statement
Random link
ASP Forms
Interact with a user in a form that uses the "get" method
Interact with a user in a form that uses the "post" method
Interact with a user in a form with radio buttons
ASP Cookies
ASP Response Object
Write text using ASP
Format text with HTML tags
Redirect the user to another URL
Random links
Controlling the buffer
Clear the buffer
End a script in the middle of processing
Set how many minutes a page will be cached in a browser before it expires
Set a date/time when a page cached in a browser will expire
Check if the user is still connected
Set the type of content
Set the name of character set
ASP Request Object
Send extra information within a link
A QueryString collection in its simplest use
How to use information from forms
More information from a form
A form collection in its simplest use
How to use information from forms
More information from a form
A form with radio buttons
A form with checkboxes
How to find the visitors' browser type, IP address and more
List all servervariables you can ask for
Welcome cookie
Total number of bytes the user sent
ASP Session Object
Return session id number for a user
Get a session's timeout
ASP Server Object
When was a file last modified?
Open a textfile for reading
Home made hit counter
ASP FileSystem Object
Does a specified file exist?
Does a specified folder exist?
Does a specified drive exist?
Get the name of a specified drive
Get the name of the parent folder of a specified path
Get the file extension
Get the base name of a file or folder
ASP TextStream Object
Read textfile
Read only a part of a textfile
Read one line of a textfile
Read all lines from a textfile
Skip a part of a textfile
Skip a line of a textfile
Return current line-number in a text file
Get column number of the current character in a text file
ASP Drive Object
Get the available space of a specified drive
Get the free space of a specified drive
Get the total size of a specified drive
Get the drive letter of a specified drive
Get the drive type of a specified drive
Get the file system of a specified drive
Is the drive ready?
Get the path of a specified drive
Get the root folder of a specified drive
Get the serial
number of a specified drive
ASP File Object
When was the file created?
When was the file last modified?
When was the file last accessed?
Return the attributes of a specified file
ASP Dictionary Object
Does a specified key exist?
Return an array of all items
Return an array of all keys
Return the value of an item
Set a key
Return the number of key/item pairs
ASP AdRotator
Display a different image each time a user visits a page
ASP Browser Capabilities
Find the type, capabilities, and version of each browser that visits your site
ASP ContentRotator
Display a different content each time a user visits a page (ASP 3.0)
ASP Content Linking
Build a table of contents
Navigate between pages in a text file