Javascript Tutorials
Introduction to AJAX
Javascript Form Validation
Javascript Fundamentals

Javascript Fundamentals

Objects and Classes

Objects are containers. They can hold other objects. Examples of objects include forms, arrays, images, and links. To create an object use var objectName = new Object();. After creating the object child object and properties can be defined.

<SCRIPT TYPE="text/javascript" LANGUAGE="Javascript_1.2">
objectName = new Object();
objectName.childObject = new Object();
objectName.property="String property";
</SCRIPT>

This code creates an object called objectName then creates a child object called childObject. After we created our objects its time to set a value to an object property, which is done just like setting a variable.

Classes are groups of objects that are related in some way. For example if I have the image <IMG src="logo.gif" name="logo" height="60" width="120" alt="logo"> and I want to find the height of it. The height of the image is stored in the object document.images["logo"].height

Arrays <<  1 2 3 4 5  >> Output to Browser
New Content