166 Part III .Document Objects Reference The (Fedora web server) strings

166 Part III .Document Objects Reference The strings returned from this method are roughly equivalent to values of text fragment nodes in the W3C DOM, but IE5 treats these data pieces only as string data types rather than as text node types. Cross-browser DOM equivalents for the four versions are: document.getElementById( objName ).previousSibling.nodeValue document.getElementById( objName ).firstChild.nodeValue document.getElementById( objName ).lastChild.nodeValue document.getElementById( objName ).nextSibling.nodeValue Example on the CD-ROM Related Items: childNodes, data, firstChild, lastChild, nextSibling, nodeValue, and previousSibling properties. getAttribute( attributeName [, caseSensitivity]) Returns: See text. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The getAttribute() method returns the value assigned to a specific attribute of the current object. You can use this method as an alternative to retrieving properties of an object, particularly when your script presents you with the attribute name as a string (in contrast to a fully formed reference to an object and its property). Thus, the following example statements yield the same data: var mult = document.all.mySelect.multiple var mult = document.all.mySelect.getAttribute( multiple ) Returned value types from getAttribute() are either strings (including attribute values assigned as unquoted numeric values) or Booleans (for example, the multiple property of a SELECT element object). The W3C DOM Level 2 standard recommends getAttribute() and setAttribute() for reading and writing element object attribute values, rather than reading and writing those values by way of their corresponding properties. While using these methods is certainly advisable for XML elements, the same DOM standard sends conflicting signals by defining all kinds of properties for HTML element objects. Browsers, of course, will support access via properties well into the future, so don t feel obligated to change your ways. Note On the CD-ROM elementObject.getAttribute()
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply