CD-141Appendix F . Examples from Parts III and (Web server extensions)
CD-141Appendix F . Examples from Parts III and IV Example The IE4+ page generated by Listing 15-11 contains an H1 element label and a paragraph of text. The purpose is to demonstrate how the innerHTMLand innerText properties differ in their intent. Two text boxes contain the same combination of text and HTML tags that replaces the inner content of the paragraph s label. If you apply the default content of the first text box to the innerHTMLproperty of the label1 object, the italic style is rendered as such for the first word. In addition, the text in parentheses is rendered with the help of the small style sheet rule assigned by virtue of the surrounding tags. But if you apply that same content to the innerText property of the labelobject, the tags are rendered as is. Use this as a laboratory to experiment with some other content in both text boxes. See what happens when you insert a
tag within some text of both text boxes. Listing 15-11: Using innerHTML and innerText Properties