tailieunhanh - JavaScript Bible, Gold Edition part 63
JavaScript Bible, Gold Edition part 63. 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. | 468 Part III Document Objects Reference pasteHTMLCHTMLText Returns Nothing. NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility While the execCommand method offers several commands that insert HTML elements into a text range it is probably more convenient to simply paste fully formed HTML into the current text range assuming you need to be working with a text range instead of even more simply setting new values to an element object s outerHTML property . Provide the HTML to be inserted as a string parameter to the pasteHTML method. Use the pasteHTML method with some forethought. Some HTML that you may attempt to paste into a text range may force the method to wrap additional tags around the content you provide to ensure the validity of the resulting HTML. For example if you were to replace a text range consisting of a portion of text of a P element with for instance an LI element the pasteHTML method has no choice but to divide the P element into two pieces because a P element is not a valid container for a solo LI element. This division can greatly disrupt your document object hierarchy because the divided P element assumes the same ID for both pieces. Existing references to that P element will break because the reference now returns an array of two like-named objects. On the Example on the CD-ROM CD-ROM Related Items outerHTML-property i nsertAdjacenHTML method. queryCommandEnabledC commandName queryCommandIndetermC commandName queryCommandStateC commandName queryCommandSupportedC commandName queryCommandTextC commandName queryCommandValueC commandName Returns See in Chapter 18. NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility See descriptions under in Chapter 18. Chapter 19 Body Text Objects 469 select Returns Nothing. NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility The select method selects the text inside the boundaries of the current text range. .
đang nạp các trang xem trước