Javascript Common Library (Broken)

April 2003

Javascript is a prototype based, dynamically typed language. It is an excellent scripting language given its simplicity. Javascript even allows inheritance; I have a document that covers inheritance in a prototype based language .

DHTML is a Problem

Javascript has a problem: Good libraries are essential to making a language useful, and Javascript has few to none. This page is the framework for creating a common library that interfaces with the plethora of browsers' Document Object Models (DOMs).

The SuperTable

As a first test of this new library (current works on Mozilla 5, Netscape6+ and IE4+) I have made the SuperTable. I will be adding features to this in the future. Try Resizing the columns.

Class Name Number of Methods Parent Description
aObject 14 Normalizes the common properties of DHTML objects
aCell 3 aObject A cell in a table
aRow 4 aObject A row in a table
aTable 9 aObject A table
aColumn 2 A column in a table (browser independent implementation)

The Design

Order is important so that the objects are created correctly.

    1. Utility Functions
      The Debug and String modules have some function that you may find useful. The String module has a few useful functions that the Javascript prototypical object lacks. This String module is incomplete.
    2. Browser Specific Wrappers for Docum ent Objects
      Each type of document object for each type of browser is given a browser specific class object. The name of the class begins with an "a" and has a 3 character suffix signifying the browser it supports. All translation between the document objects and the class interface is done here.
    3. Useful Objects
      These objects are built on top of the class objects and add functionality. Things like moving, dragging and my SuperTable object.
    4. The BrowserType Module
      The BrowserType module identifies the browser being run and maps the browser specific class objects to more general interface objects
    5. The Main Routine
      This is what you write to instantiate objects and perform useful tasks.