CGI, Javascript

Tonight we will look at:

  • Forms
  • CGI (Common Gateway Interface scripts)
  • JavaScript
  • Java
Forms

A 'form' is used to gather some response from the client. Forms can be of a number of different types. Dependant on the type of information you want from the reader would determine what type of form you would use.

drop down

 one line text box

Scrolling text box

Check box

Radio button

Push Button

Once you click the 'submit' button the browser will do something with the information. Usually this means running a javascript or sending the information to the CGI for processing.

CGI

CGI scripts are small programmes which reside on a web server, usually in a directory called cgi-bin. They are written in various computer languages. The reason for their name is that they provide a 'gateway' between the user and the webserver. They process information that is submitted in some way before passing it to either the webserver or the browser.

Each of the following uses a CGI script to work. If you looked at the source HTML code, each of them at one stage would have a command something like: 

<FORM action=http://school.discovery.com/cgi-bin/correct_quiz.cgi method=post>

this is the command line that send the information entered to the cgi programme for processing (checking).

Javascript

Javascript is actually a small script that is embedded into a HTML document and run on the client's computer. What follows is a simple javascript that automatically prints the date that a webpage was last edited

<script language="JavaScript1.1">
<!--hide from old browsers

var wholestring = document.lastModified;
var datestring = wholestring.substring(0,7);
var yearstring = wholestring.substring(wholestring.length-5,wholestring.length);
document.write("This document was last updated "+ datestring + " " + yearstring+".");
// -->
</script>

You can download scripts such as these and run them inside a webpage. A great repository of javascripts is held at www.javascripts.com

Task 1

Go to www.javascripts.com and look for a script that you could use on your website.

Task 2

Go to Douglas Mill's excellent page on Javascript for language learning and read about the advantages and disadvantages.

Task 3

Check out some of these language learning activities that use javascript. Check the source HTML code to see the actual script itself.

There are more examples linked off this page.

A range of software designed to create web-based quizzes, such as Hot Potatoes and Maxauthor create their activities using javascripts based upon what you enter. Maxauthor uses a cgi script to check the answers, too.

You can download a copy of Maxauthor and Hot Potatoes for free!!

More examples of what they can do:

Of course there are a range of sites on the net that will create the javascript quizzes for you.

Task 4

Using any of the above sites or templates, create a sample javascript quiz for your students.

Douglas Mills has more templates that you could use at his site.

Java

Java applets are actual programmes that are downloaded automatically by the computer, often with the extension of .cls or .class, when a HTML document is loaded.