JavaScript Bible, Gold Edition part 60. 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. | 438 Part III Document Objects Reference var newHTML H1 Howdy H1 if newHTML var newFragment newHTML See the description of the method ear- lier in this chapter for the application of a document fragment node in NN6. Example on the CD-ROM On the CD-ROM Related Items method. selectNode nodeReference selectNodeContents nodeReference Returns Nothing. NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility The selectNode and selectNodeContents methods are convenience methods for setting both end points of a range to surround a node or a node s contents. The kind of node you supply as the parameter to either method text node or element node has a bearing on the range s container node types and units of measure for each see the container- and offset-related properties of the Range object earlier in this chapter . Starting with the selectNode method if you specify an element node as the one to select the start and end container node of the new range is the next outermost element node offset values count nodes within that parent element. If you specify a text node to be selected the container node for both ends is the parent element of that text node offset values count the nodes within that parent. With the selectNodeContents method the start and end container nodes are the very same element specified as the parameter offset values count the nodes within that element. If you specify a text node s contents to be selected the text node is the start and end parent but the range is collapsed at the beginning of the text. By and large you specify element nodes as the parameter to either method allowing you to set the range to either encompass the element via selectNode or just the contents of the element via selectNodeContents . On the Example on the CD-ROM CD-ROM Chapter 19 Body Text Objects 439 Related Items setEnd setEndAfter setEndBefore setStart