What is the standard method of referencing an element object in the DOM?
The DOM specification includes getElementById() and getElementsByTagName() methods for general access to all elements in the document tree. While both IE (since 4.0) and NN (since 6.0) comply with most of the standard interface specified in the DOM, these and other versions of both browsers used their own proprietory object models prior to standardization of the DOM. It becomes imperative then, to understand how to work around the differences, to create scripts that will work across most browsers. Internet Explorer 4.0 and later: IE4+ provide scripting access to all HTML page elements in the following, essentially equivalent, ways · Using an element’s id: elementId.propertyName · Using the document.all collection, and referring to the object either via the element’s index, name, or id, as in the below examples: document.all[0].propertyName document.all[‘elementName’].propertyName document.all[‘elementId’].propertyName For example, the code below can be used in IE to display in an alert