Introduction to Web-scripting languages

This course was given in 1999 as one of the Emerging Technologies (INT3004) courses at Griffith University (School of Information Technology), Australia. Some links have been added much more recently.

Wed. 22/09 General introduction
Introduction to Javascript features and ressources
Javascript program handling form elements
The Javascript project (to be completed by Wed. 20/10)
Fri. 24/09 Javascript exercises

Wed. 06/10 The Get and Post methods of the CGI to encode parameters
Javascript program to encode/decode Get parameters and handles windows
Security issues: 1, 2, 3
Fri. 08/10 Exercises on window handling and parameter sending in Javascript

Wed. 13/10 Shell script using a C program to decode the GET/POST parameters
C Script storing its GET/POST parameters into an associative list
Decoding function used in the previous script
Interface to test the previous scripts
The W3C Library (e.g. to access files on the Net from C programs)
Fri. 15/10 Exercise on CGI servers in C and shell

Wed. 20/10 Introduction to some successors/complements of HTML 3.2: HTML 4 (see also this Widely Supported HTML4 and Unicode Charactersand this complete list), XHTML 2, XML, VRML, CSS, XSL and DOM
Example of HTML+CSS file
CSS1, CSS2, CSS1 rules for HTML 2.0, CSS2 rules for HTML 4.0
Tips for faster download (see How to dynamically load any html file component but remember that most browsers will cache JavaScript files, so only the first page the reader views will have a delay, but still, there is no need to cause delays).
Extensive demo site for CSS
Old postscript slides
Fri. 22/10 Exercises with CSS (+ evaluation of the Javascript project ?)

Solutions to the examination.

General introduction

Markup languages, such as HTML, XML and VRML, allow the storage of structured data in a textual form, via the association of "tags" or "marks" to document elements (DEs). A tag isolates a DE from the rest of the document and represents a property of a DE, e.g. that it is a paragraph, a section, an image, or an hyperlink link source/destination. The embedding of tags within others also support the structuration of the data. Thus, markup languages may be used to store databases as well as structured documents.

Though some tags may be directly used for presentation purposes (e.g. in HTML, the "italics" tag), it is better to use tags only for storing and structuring data content, and then associate default presentation rules to the tags according to the media (e.g. screen, printer, audio) or the application. Examples of languages for associating presentation rules to HTML/XML tags are CSS and XSL.

Markup languages and presentation rules enable the creation of static documents, i.e. documents which have a fixed content.

The HTTP protocol allows a program (e.g. a Web browser such as Netscape) to ask another program for a document. The document is refered by a URL (or URI). The two programs may not be on the same machine. The one which provides the document is called the "server", the one which receives it is called the "client".

To allow the creation of dynamic documents, actions need to be associated to some document elements to handle certain events from the user, e.g. the selection of a portion of text with a mouse, the insertion of text into a text area, the click of a button. The main two current ways of doing this on the Web is to exploit the "CGI protocol" or to use a script language understood by the browser.

In the first case, when the user clicks on a submit button, the content of "form" elements (e.g. the text in text fields and the selections of menus or radio buttons) is encoded and sent by the browser to a Web-accessible program the URL of which has been associated to the submit button by the document author. Then the program uses this information as parameters for some action, creates an HTML document to show the results and sends it back to the browser which displays it. Thus, the CGI protocol allows to send parameters to "servers".

In the second case, the document author uses a script language to program actions and associate them to certain events on form elements or hyperlink elements. When one of these events happens, the browser executes the related action. As the interpretation is done by the browser, such programs are said to be client-side applications. Javascript is the main scripting language for such applications since it is understood by (though only by) the browsers Netscape Navigator 2.0 (or later) and Internet Explorer 3.0 (or later). Javascript was invented by Netscape but is now standardized under the name of ECMAScript.

It should be noted that Javascript can also be used in a server-side application, e.g. with the Netscape Enterprise Server. Languages such as C are more generally used for client-side applications. Server-side Javascript is not introduced any further in this course. Since server-side applications run on the machine where the program is stored, they may be slow to answer because of the transfer delays on internet and because many users may call the application (or other applications on the same server) at the same time. However, server-side programs may be compiled, they may read or write files on the server machine or communicate with other programs on this machine. Client-side applications cannot read or write files on the user machine.

Philippe A. MARTIN
E-mail: pm .@. phmartin dot info   (please replace " at " by "@"; sorry for this anti-spam technique)

URL of this document:
Last modified: Tue Nov 23 15:10:09 EST 1999