Student Menu. © Lesson 2. Printable layout. Links won't function in print.
Notes
Section
|
Main
Text
|
|
Read Course Text.
|
|
What is the Difference
Between Client-Side and Server-Side Scripting?
By
adding <SCRIPT RUNAT=SERVER> a script may be forced to run at the
server rather than the client; however, this only works if the server is
configured to handle that particular scripting language. |
Module 2.2 *As JavaScript and JScript reach full
compliance with ECMAScript Standards, their inconsistencies in
Netscape and IE browsers will diminish and a vendor-neutral,
client-side scripting language will hopefully emerge on the Web. The European Computer Manufacturers Association’s
(ECMA) goal is to foster a reliable scripting standard. Both
Netscape and Microsoft have pledged future version compliance. |
What are VBScript, JScript and JavaScript?
VBScript:
Based on the Visual
Basic (VB) programming
language.
Both VBScript and Visual
Basic for Applications (VBA) are subsets of the VB language. VBScript
is an embeddable language requiring a scripting
host and cannot be compiled into an independent application. JScript:
Introduced by Microsoft to compete against Netscape’s popular
JavaScript. Both JavaScript 1.1 and JScript 2.0 were the source for ECMAScript*,
the only standardized Web scripting language. JavaScript: The first client-side scripting language. Originally called LiveScript. Strategically renamed under agreement with Sun Microsystems to take advantage of the Java marketing publicity. JavaScript and Java are distinctly different languages: JavaScript is interpreted while Java is compiled (into bytecode).
|
Module
2.3 |
What are Data Types, Variables, Expressions, Operators and Arrays? (programming review only) 1. In the JScript Language Reference click the Search tab > type Data Types > click List Topics > double-click the second choice JScript Data Types > click the Refresh button to remove the highlighting. 2. Use the same procedure to find and critically review Variables, Expressions and Operators. Note that the word Expression may be found in the JScript Language Reference by typing JScript Code in the Search tab and then clicking the fourth topic. It is highly recommended that you paraphrase or outline this very important information in order to understand it better. The sooner you master these concepts, the easier it becomes to write your own JavaScripts.
3. Arrays
are more effective than variables for storing a series of related data
items. Each data item in the series is referenced by an index number
which begins at zero. Arrays are created using the new Array ( )
Object. The power of an array is in its ability to
manipulate a series of data items as if they were a single data item. See Using
Arrays and the Array Object under the Search tab of
the JScript Language Reference.
|
Module
2.4 |
What Are Control Statements? (programming review
only) 1. Some control statements branch: If and If-Else 2. Other control statements loop:
For, For-In, While, Do-While
and Switch In the JScript Language
Reference
click the Search tab > type Control > double-click the first choice,
Controlling Program Flow and critically review the page. See also, Functions
in the JScript Language Reference. Try to find, modify or
create your own code
examples for each type of control statement.
|
Module 2.5 |
Commenting Code and Include Files. Commenting Code. It cannot be understated the importance of thoroughly commenting code or hypertext mark-up. Intellectual property like code or mark-up becomes useless without comments just like a book report is worthless without a bibliography. Headaches are created for people who weren’t the original developers of the script if there isn’t a clear step-by-step description of what the script does and how the script does it. All formally trained programming professionals thoroughly comment their code and mark-up! 1. HTML: <!-- This is an HTML comment. --> 2.
JavaScript: Single lines are commented with the double
slash // . Blocks of code are
commented with the /* */
syntax. Include Files. JavaScript
include files are pure JavaScript without HTML or the <SCRIPT> tags. They have a .js extension and
may not be supported by all web servers; consequently, include files won't be
used in this class. |
The
actual object used is called the instance. |
An Object is a thing. A Property is a characteristic (of the Object). A Method is an action (the Object can perform). An Event is a user action (having Event Handlers).
Using a real-world example, we have a Hand Object (thing) that has a Finger Property (characteristic) that has a Wave Method (action).
A hand with a long finger is described by the following
syntax:
This syntax tells the hand to wave fast: Hand.Wave("fast") Fast is
an argument or value of the Wave Method*.
In document.write("Hello Everyone!") the document Object has a write Method with a string argument.
|
Module 2.7 |
Exercise 2.
|
Module 2.8 |
Quiz 2.
|