My web server - 231Chapter 15Generic HTML Element Objectstags in the content,

231Chapter 15Generic HTML Element Objectstags in the content, the text is rendered as is.) For example, consider the following bit ofHTML source code:

How are you? he asked.

The value of the paragraph object s innerHTMLproperty(document.getElementById( paragraph1 ).innerHTML) is: How are you? he asked. The browser interprets any HTML tags that you include in a string you assign to an element sinnerHTMLproperty as tags. This also means that you can introduce entirely new nested ele- ments (or child nodes in the modern terminology) by assigning a slew of HTML content to anelement s innerHTMLproperty. The document s object model adjusts itself to the newlyinserted content. In contrast, the innerTextproperty knows only about the text content of an element con- tainer. In the example you just saw, the value of the paragraph s innerTextproperty (docu- ment.getElementById( paragraph1 ).innerText) is: How are you? he asked. It s important to remember that if you assign a string to the innerTextproperty of an ele- ment and that string contains HTML tags, the tags and their angle brackets appear in the ren- dered page and are not interpreted as live tags. Do not modify the innerHTMLproperty to adjust the HTML for frameset, html, head, or titleobjects. You may modify table constructions through either innerHTMLor the various table- related methods that create or delete rows, columns, and cells (see Chapter 37 on the CD-ROM). It is also safe to modify the contents of a cell by setting its innerHTMLor innerTextproperties. When the HTML you insert includes a