Advanced DOM Techniques
div and a
span, and how to hide, show, and move HTML elements by changing various attributes of their
style objects. We've also seen how to get access to HTML elements using
getElementsByTagName(). All of these techniques make a web page dynamic by altering HTML elements that are already on the page. This section discusses a few ways to dynamically add new HTML elements to a web page.
Actually, we've already added new HTML elements to a web page by putting them in the
innerHTML property of a
makeBig() function in Figure 13-14, for example, added a new
<font> tag to the page. Often, injecting HTML into your web pages using ...