Uncle Jim's Web Designs and Tutorials

This is part ten of a series on Dynamic HTML

Binding Javascript to the DIV:

Associating Javascript objects to the browsers' <DIV> objects is one of the most important steps in creating DHTML code. In javascript , you can assign new variables and or functions to most existing objects, even those representing HTML layers.

Binding to layer objects

You can bind to layer objects using the following code example:

// *** This line merges the syntax for cross-browser references to layers

// *** This declares a simple binding object
// that makes an association between the HTML layer and javascript 
function DCbindTo(layerName)

The understanding of the above code is important in using DHTML. Often, Javascript events contain a reference to a layer object, but also need a way to reference any custom classes along with any related values and functions declared. Javascript allows you to assign various types of objects as a member of any other object.

Next, we get into Event handling.