October 2010
Intermediate to advanced
1920 pages
73h 55m
English
Before we do anything else, we need to discuss how you create an external JavaScript file and reference it in a Web Form page. Although you can add JavaScript directly to a page by wrapping it in <script> tags, it is better to separate your client-side logic into its own file. You create a JavaScript file by selecting Website, Add New Item and selecting the Jscript File option (see Figure 40.3).
Figure 40.3. Creating a script file with Visual Web Developer.

For example, the file in Listing 40.1 contains a single JavaScript function called sayMessage() that displays a JavaScript alert with a message.
Listing 40.1. myScript.js ...