• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 19. Using Advanced DOM Features > Modifying Text within a Page

Modifying Text within a Page

Next, you can create a simple script to modify the contents of a heading within a Web page. As you learned earlier this hour, the nodeValue property of a text node contains its actual text, and the text node for a heading is a child of that heading. Thus, the syntax to change the text of a heading with the identifier head1 would be:

Var head1=document.getElementById("head1");
Head1.firstChild.nodeValue="New Text Here";


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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