O'Reilly logo

JavaScript® Bible, Seventh Edition by Paul Novitski, Danny Goodman, Tia Gustaff Rayl, Michael Morrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 33. Body Text Objects

IN THIS CHAPTER

  • Objects that display running body text in documents

  • Using the NN/Mozilla Range and IE TextRange objects

  • Scripting search-and-replace actions

A large number of HTML elements fall into a catchall category of elements whose purposes are slightly more targeted than contextual elements covered in Chapter 26, "Generic HTML Element Objects." In this group are some very widely used elements, such as the h1 through h6 header elements, plus several elements that are not yet widely used because their full support may be lacking, even in some of the most modern browsers. In this chapter, you find all sorts of text-related objects, excluding those objects that act as form controls (text boxes and such, which are covered in Chapter 35, "Text-Related Form Objects"). For the most part, properties, methods, and event handlers of this chapter's objects are the generic ones covered in Chapter 26. Only those items that are unique to each object are covered in this chapter (as will be the case in all succeeding chapters).

Beyond the HTML element objects covered in this chapter, you also meet the TextRange object, first introduced in IE4, and the corresponding Range object from the W3C DOM. This object is a very powerful one for scripters because it allows scripts to work very closely with body content—not in terms of, for example, the innerText or nodeValue properties of elements, but rather in terms of the text as it appears on the page in what users see as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required