• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Creating New Elements

You also can create new elements with the document object’s createElement method (see Table 9.5) and insert them into a document on-the-fly with methods such as insertBefore (see “The insertBefore Method” in Chapter 6) after configuring them.

We’ve seen createElement in passing before, but we haven’t taken a systematic look at this process. The important thing to realize is that the mere creation of a new element does not insert that element into the document. Instead, you first configure the new element using various properties such as name and value. When the element is ready for use, you can insert it into the document using methods such as insertBefore. (This method was introduced in Internet Explorer 5.0 and is now supported in Netscape Navigator 6.0.)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint