The CTDP JavaScript Manual Version 0.6.0, December 31, 2000

Starting JAVA Script

JavaScript is normally found embedded in HTML code. That is because JavaScript is run by the client computer's browser. JavaScript is supported by all internet browsers and was standardized by the European Computer Manufacturers Association (ECMA). It was standardized under the name ECMAScript and it is vendor-neutral standard. Visual Basic Script (VBScript) on the other hand is a Microsoft supported language. When a person is surfing the web, they click on a link which will cause the browser to make a request for a specific HTML page or other type of file from a web server (HTTP server). These servers contain pages that are sent to the client using the HTTP protocol normally serviced on port 80. The HTML page may contain JavaScript which is run by the browser when the HTML page or other type of file is loaded.

Required Knowledge

This document assumes the reader has some familiarity with programming and HTML. It is intended to give a quick overview of JavaScript fundamentals with examples, and outline available functions. Arithmetic operators, logical comparison, and bit manipulation statements are not specifically explained in this document since they work in the same manner as the C and C++ programming languages. Differences between JavaScript and C are:

  • Strings are added with the + operator.
  • Data types are not explicitly cast nor must they be converted. This is explained later.

The Key to Understanding JavaScript Quickly

The key to a quick understanding of JavaScript lies in the structure of its objects. JavaScript is an object oriented language. Beyond that, it has many similarities to the C programming language. Variables are declared before use but they are not explicitly typecast. The variable type is normally determined by its use. The ability to do anything in a programming language requires functions supported by the language. JavaScript contains a few functions that are not part of objects. These functions are generally for variable type conversion to a specific type along with support of some dialog boxes. The rest of the functionality of JavaScript is contained in its objects. The objects contain:

  1. Methods (Functions)
  2. Parameters (Data or Other objects) - Describe characteristics of the object
  3. Events - Events are tied to objects

JavaScript has basically three types of objects which are:

  • Top level objects
  • Objects that are properties of other objects. (What I call sub objects)
  • Objects that are not properties of other objects (What I call independent objeects)



JavaScript objects do not have the normal class to subclass relationship, but are contained within one another and they do not inherit properties from each other. JavaScript is a tool to allow manipulation of objects that are already created by the computer system such as "navigator" to access browser characteristics.

Syntax Rules

  • Statements may contain a semicolon at the end of them as in C, but it is not necessary unless there are multiple statements on one line. Multiple statements on one line must be separated by a semicolon.
  • JavaScript is case sensitive.
  • Quotes may be single quote (') or double quote ("). When embedded within each other they must be used consistently as in the following example.

    onMouseOver="window.status='To Operating Systems Section' ;return true"

  • Comments are the same as in C++ with the "//" characters for a single line comment, and the "/*" for the beginning of a multiline comment and the "*/" for the end of a multiline comment.
  • Variables must be defined before they are used.