|Lesson 4||Scripting Languages|
|Objective||Describe the Functions of Common Types of Scripting Languages|
The next type of language you will learn about is scripting language. A scripting language is based on a host, or primary language, but it uses a simplified command method with reduced functionality
to accomplish basic operations such as form handling and text processing (or anything else). For example, VBScript is the scripting language based on VBasic, the host, or primary language.
A script example
Let's understand this relationship between a script and its host. Imagine writing two short programs. The first one is designed to scan a document for the word "America." When found, the program is to simply bold and italicize it.
We'll call that program "Find-Am." The second program scans the document for the word "Columbus" and also bolds and italicizes. We'll call it "Find-Col." If each program were written in, say, Visual Basic (VB),
then Visual Basic would be the host language.
We can now write a script that will find, bold, and italicize the words "America" and "Columbus" just by typing two commands: Find-Am, and on the next line, Find-Col. While the script command triggered the programs, the actual changes were executed by the program's host, which was Visual Basic.
Easier, but slower
The nice thing about scripting languages is they're easy to learn, because you only need to concentrate on the names of the functions, not how they are developed.
So scripting languages are really simplified programming languages that use pre-named modules, each activated sequentially via a script. The drawback is a lack of flexibility when attempting to perform unique operations.
Finally, their execution tends to be much slower than true 'code' in performing similar operations.
Scripts: what and where?
Since scripts are just a series of name modules, their use has become quite popular in Web pages. Small scripts, placed within a Web page can activate a browser's host language (usually Java or VB) to perform fairly
complex tasks like graphic animation or numeric calculation. Let us look at a few of these operations.
Learning Web Design
What can client-side scripts do?
Client-side scripts are embedded in HTML pages.
Because the processing occurs at the user's computer, scripts speed the interaction by saving processing time at the Web server, and saving traffic time going to and from the server. Client-side scripts are used to perform the following functions:
- Provide drop-down menus to enhance site navigation
- Open a browser window
- Generate events such as a MouseOver, that is, a change in graphics or text when a user's mouse touches an element on the screen
Check for a plug-in or a particular browser version and display the appropriate page
Validate user input (such as, "Entries in the zip code field must have 5 numbers")
- Display error or informational pop-ups
Because the code is relying on the browser, developers should be aware of the following limitations:
- There may be limited browser support for some functions.
As you become more acquainted with the Web environment, you'll hear more and more about particular feature incompatibilities between Netscape
and IE (Internet Explorer). One primary area of contention relates to the execution of scripts. For example, not all scripts work on both browsers.
As you'll read below, ActiveX scripts will not work in Netscape, while they'll work fine in Explorer.
The opposite is true for certain Java scripts. The reason is that each manufacturer (Netscape vs. Microsoft)
has provided different host language capabilities in their browsers.
Applets, Java applets, and ActiveX
Applets, Java Applets, and ActiveX are programs run on the client side. An applet is a small application such as a utility.
Java applets are small programs written in the Java language. ActiveX, from Microsoft, adds functionality by enabling a program to call forth ready-made
components to perform common tasks. ActiveX is typically used to add user interface functions and enhance the processing of multimedia commands.
What can server-side scripts do?
Server-side scripts are used to extend the functionality of a Web server. For example, CGI (Common Gateway Interface) scripts can be used to add interactivity to Web pages. It's often referred to as a "transport" language because its job is to transport data
from the user's Web page into the server for execution by a program (like VB). CGI does not actually perform calculations.
Typical applications for CGI scripts include:
- Interactive forms for handling the submission of data from a Web client, such as a guest book or order form
- Searchable indexes of documents on the Web server
- Page counters to track how many visitors a Web page receives
CGI scripts can be written with a procedural, object-oriented, or scripting language such as Perl. Other functions that can be performed with a server-side scripts include:
In the next lesson, you will begin learning about the wide variety of software applications that are used in creating and running Internet sites.
- Collecting form data
- Generating dynamic page content
- Sending and receiving cookies
- Accessing a database
- Redirecting a visitor to another URL
- Managing shopping carts
- Validating credit card information used for purchasing
Web Scripting Languages
Web Application Language Review - Quiz