TOC PREV NEXT INDEX

domref



id


The id property uniquely identifies the current element.

Syntax

id_str = element.id
 
element.id = id_str
 

Parameters

id_str is a string representing the id of the current element.

Example

if element.id != "main_loop"
 
    goBack();
 

Notes

There is no more central property to the domain of web development than id. The ID of an element is what is most often used to retrieve it (i.e., with getElementById), and it allows the various nodes in a document to be manipulated independently of one another. In HTML and in XUL, the id is defined as an attribute on the element like so:

<td id="table-cell2" />
 

If you plan to use the DOM with your web pages, it's a good idea to give as many of your elements id attributes as is necessary. Note that the id element is also frequently used to associated style rules with individual markup elements.

Specification

id
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX