Chapter 36. 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 15. 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 in even 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 23). For the most part, properties, methods, and event handlers of this chapter's objects are the generic ones covered in Chapter 15. 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 paragraphs, lists, and the like. The TextRange
and Range
objects ...
Get JavaScript® Bible, Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.