C.6. Objects

This section provides details on the multitude of objects available in JavaScript.

C.6.1. Anchor Object

The Anchor object corresponds to the XHTML anchor tag (<a>). You can use this object to create an anchor with the document.write() method in addition to writing specific code for the anchor. The following examples are identical:

var myheader = "Chapter 1";
document.write(myheader.anchor("Chapter_1"));

document.write('<a name="Chapter_1">Chapter 1</a>');
C.6.1.1. Properties

There are no properties specific to the Anchor object.

C.6.1.2. Methods

There are no methods specific to the Anchor object.

C.6.2. Area Object

An Area object is a type of Link object and has the same attributes. This object corresponds to the XHTML <area> tag. For more information on the Area object, see the Link object.

C.6.2.1. Properties

There are no properties specific to the Area object.

C.6.2.2. Methods

There are no methods specific to the Area object.

C.6.3. Array Object

The JavaScript Array object is similar to other languages' array objects, holding an ordered set of values. The following example creates an array of four string elements:

fruits = new Array("banana", "pear", "apple", "strawberry");

Elements of an array can be accessed by their numeric index, corresponding to their position in the array, starting with 0. For example, you could access the second element in the preceding array ("pear") as fruit[1].

C.6.3.1. Properties
PropertiesDescription
indexThe index property created ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.