Client-Side Scripting

Overview

ASP is a server-side scripting environment. Client-side scripting complements ASP nicely, allowing for a number of enhancements, such as ActiveX® controls, that can make your application more powerful and user-friendly.

Code Tour

This example demonstrates how you can include a client-side script in your preferred scripting language. This script defines a subroutine called DoIt within the <SCRIPT> tags. Note that there is no RUNAT=SERVER attribute present, which indicates that the script is an ASP subroutine. The page provides one button for the user that, when clicked, executes the DoIt subroutine on the client browser.

This sample demonstrates a very useful advantage to combining ASP scripts with client-side scripting. When ASP encounters the <SCRIPT> tags, it does not simply ignore everything within that block. It continues to search for, parse, and execute script elements, specified with delimiters (<% ... %>), that are meant for the server. This example, therefore, returns within a client-side script the session information returned from the Session.SessionID method.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\interaction\ClientScript_VBScript.asp and ...\asp\interaction\ClientScript_JScript.asp.