154 Part III .Document Objects Reference var newB (Web host forum)
154 Part III .Document Objects Reference var newB = document.createElement( B ) newB.appendChild(document.createTextNode( Important! )) At this point, you can append or insert the newBelement. It appears with its content ready to go. The appendChild() method returns a reference to the appended node object. This reference differs from the object that is passed as the method s parameter because the returned value represents the object as part of the document rather than as a freestanding object in memory. Example (with Listing 15-21) on the CD-ROM Related Items: removeChild(), replaceChild() methods; nodes and children (Chapter 14). applyElement(elementObject[, type]) Returns: Nothing. NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5 Compatibility The applyElement() method (not implemented in IE5/Mac) enables you to insert a new element as the parent or child of the current object. An important feature of this method is that the new object is wrapped around the current object (if the new element is to become the parent) or the current object s content (if the new element is to become a child). When the new element becomes a child, all previous children are nested further by one generation to become immediate children of the new element. You can imagine how the resulting action of this method affects the containment hierarchy of the current element, so you must be careful in how you use the applyElement()method. One parameter, a reference to the object to be applied, is required. This object may be generated from constructions such as document.createElement() or from one of the child or node methods that returns an object. The second parameter is optional, and it must be one of the following values: Parameter Value Description outside New element becomes the parent of the current object inside New element becomes the immediate child of the current object If you omit the second parameter, the default value (outside) is assumed. On the CD-ROM elementObject.applyElement()
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.