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:
- Methods (Functions)
- Parameters (Data or Other objects) - Describe characteristics of the object
- 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)
|