LIBR 246
Avanced Information Techology, Tools & Applications

Quick facts: Javascript

schedule | reviews | exercises
assign 1 | assign 2 | term proj
guidelines | links | home

Introduction: What is Javascript?

Javascript is a scripting language (read: programming language) that is designed to work in web browsers or on web servers. That is, in addition to understanding HTML, some web browsers (depending on their version) also understand Javascript. Based on this understanding, Javascript allows web designers to control the way the Web browser works.

One of the most common uses of Javascript is to perform specific functions during certain events of a web interaction. An example of an event would be a click of the mouse; when that event occurs, Javascript commands can be executed to create new windows or other actions. There are many useful applications of Javascript which are event driven; that is, the Javascripts run when something happens in the browser window. But there are many other uses of Javascripts which are not event driven. The examples below will demonstrate both event-driven and non-event-driven Javascripts.

Javascript is, increasingly, also shorthand for an emerging standard called "ECMAScript." From the ECMA website:

Standard ECMA-262
ECMAScript Language Specification, 2nd edition (August 1998)

This ECMA Standard defines the ECMAScript scripting language, a general purpose, cross-platform programming language.

This ECMA Standard is based on several originating technologies, the most well-known being JavaScript (Netscape Communications) and JScript (Microsoft Corporation).

What is ECMAScript? (from Microsoft)
The ECMAScript standard describes a Web scripting language that can enrich and
enliven Web pages in a Web browser. ECMAScript is the only standard scripting
language on the Web; it is based on the ECMA-262 specification, which outlines an
object-oriented programming language for performing computations and
manipulating objects within a host environment, such as the browser. .

The basics: How do you include Javascript into your html documents?

Embedding JavaScript in HTML (this section is from Netscape's documentation)

You can embed JavaScript in an HTML document in the following ways:

  • As statements and functions within a <SCRIPT> tag.
  • By specifying a file as the JavaScript source (rather than embedding the JavaScript in the HTML).
  • By specifying a JavaScript expression as the value for an HTML attribute.
  • As event handlers within certain other HTML tags (mostly form elements).

Unlike HTML, JavaScript is case sensitive.

More?

Javascript is, like all languages, something which is acquired. While there are many shortcuts to learning language, every shortcut has it's shortcomings. Therefore, Javascript requires a certain amount of circumspection when you are deciding whether to use it. There are many useful aspects to Javascript, but there is also a significant amount of overhead involved in using Javascript. Both of these factors must be weighed when evaluating the applicability of Javascript to specific projects.

However, if more is what you want, then here are some useful resources for learning more about Javascript. All of these resources can be considered primary sources; that is, these are the "official" or "originating" documents for Javascript, Jscript and ECMAScript. If you understand one of these, you will understand the others.

How do JScript and JavaScript compare?
JScript fully complies with ECMAScript. While JavaScript 1.1 and JScript 2.0 served as
the basis for ECMA standards work, the standards process has resulted in significant
language improvements in the areas of Unicode support, IEEE math functions and
improved date functions.

More? Ok, this time a bit easier and more practical

As with all things technology, the source documentation is sometimes a bit difficult to get through. Fortunately, a whole industry has risen around this problem; witness the "for dummies" series. Here are some of the online versions of making Javascript more palatable for a wider range of users:

Examples

An event-driven example: Sending a message to the user on a mouse click

A non-event-driven example: "Date last updated" for web pages 

Rollovers: Inside Technique : Rollover Menus

Opening new windows with new URLs

   
LIBR 246: Advanced information technology, tools & applications
Last updated, 10.99

schedule | reviews | exercises
assign 1 | assign 2 | term proj
guidelines | links | home