CD-190 Part VI . Appendixes The (Best web design) first and
Wednesday, September 26th, 2007CD-190 Part VI . Appendixes The first and last statements return empty strings because the myP element has no text fragments surrounding it. The afterBegin version returns the text fragment of the myP element up to, but not including, the EM element nested inside. The beforeEnd string picks up after the end of the nested EM element and returns all text to the end of myP. Now, see what happens with the nested myEMelement: document.all.myEM.getAdjacentText( beforeBegin ) document.all.myEM.getAdjacentText( afterBegin ) document.all.myEM.getAdjacentText( beforeEnd ) document.all.myEM.getAdjacentText( afterEnd ) Because this element has no nested elements, the afterBegin and beforeEnd strings are identical: the same value as the innerText property of the element. getAttribute( attributeName [, caseSensitivity]) NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example Use The Evaluator (Chapter 13) to experiment with the getAttribute() method for the elements in the page. For IE4, use the document.allnotation. IE5 and NN6 understand the W3C standard getElementById()method of addressing an element. You can enter the following sample statements into the top text box to view attribute values. IE4: document.all.myTable.getAttribute( width ) document.all.myTable.getAttribute( border ) IE5/NN6: document.getElementById( myTable ).getAttribute( width ) document.getElementById( myTable ).getAttribute( border ) elementObject.getAttribute()
Check Tomcat Web Hosting services for best quality webspace to host your web application.