CD-147Appendix F . Examples from (Yahoo web space) Parts III and

CD-147Appendix F . Examples from Parts III and IV Example The following function demonstrates one (not very efficient) way to assign a new class name to every P element in an IE5+ document: function setAllPClasses(className) { for (var i = 0; i < document.all.length; i++) { if (document.all[i].nodeName == P ) { document.all[i].className = className } } } A more efficient approach uses the getElementsByTagName() method to retrieve a collection of all P elements and then iterate through them directly. nodeType NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility Example You can experiment with viewing nodeType property values in The Evaluator. The P element whose ID is myP is a good place to start. The P element itself is a nodeType of 1: document.getElementById( myP ).nodeType This element has three child nodes: a string of text (nodeName#text); an EM element (nodeName EM); and the rest of the text of the element content (nodeName #text). If you view the nodeType of either of the text portions, the value comes back as 3: document.getElementById( myP ).childNodes[0].nodeType In NN6 and IE5/Mac, you can inspect the nodeType of the one attribute of this element (the IDattribute): document.getElementById( myP ).attributes[0].nodeType With NN6 and IE5/Mac, you can see how the document object returns a nodeType of 9: document.nodeType elementObject.nodeType
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Leave a Reply