tailieunhanh - JavaScript Bible, Gold Edition part 33

JavaScript Bible, Gold Edition part 33. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 168 Part III Document Objects Reference for inserting removing reading or writing attribute name-value pairs within the node map. To a script the value of the attributes property can behave the same in both IE5 and the W3C DOM provided that scripts don t have to dig too deeply into the nature of each object model s idea of what an attribute object is. In IE5 an attribute object is a relatively simple object consisting of nodeName nodeValue and specified properties. In the W3C DOM an attribute object is something more substantial primarily because it inherits all the properties of the Node object. Table 5-9 compares the properties of an attribute object in NN6 and IE5. Table 15-9 Attribute Object Properties in NN6 and IE5 NN6 IE5 attributes childNodes firstChild lastChild name nextSibling nodeName nodeName nodeType nodeValue nodeValue ownerDocument parentNode previousSibling specified specified value Admittedly the three properties implemented in IE5 are the most important but the shortcut approach negates the object-oriented system of the W3C DOM. All of this is a long way to explain the W3C DOM getAttributeNode method which returns a W3C DOM attribute object. The sole parameter of the method is a case-insensitive string version of the attribute s name. You can then use any of the properties shown in Table 15-9 to get or set attribute values. Of course HTML attributes are generally exposed as properties of HTML elements so it is usually easier to read or write the object s properties directly. Example on the CD-ROM Chapter 15 Generic HTML Element Objects 169 Related Items attributes property getAttribute removeAttributeNode setAttributeNode methods. getBoundingClientRect Returns TextRectangle object. NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility IE5 assigns to every content-holding element a rectangle that describes the space that the element occupies on the page. This rectangle is called a bounding rectangle and it is .

TỪ KHÓA LIÊN QUAN