Chapter 11. Working with HTML Text Elements


graphics/chic01.gif

In this chapter, we'll take a look at working with various HTML elements that display text, as well as working with text using text ranges and text nodes in JavaScript.

In fact, we've already covered many text-handling HTML elements with JavaScript's core HTML properties, methods, and events we saw in Chapter 5, "Using Core HTML Properties," and 6, "Using Core HTML Methods and Events." You can see the core HTML elements already covered in those chapters in Table 5.3I'll list the text-handling elements from that table here in Table 11.1. These are all HTML text elements that we've already covered.

Table 11.1. JavaScript Core HTML Text Elements

Properties

     

ACRONYM

ADDRESS

B

BIG

CITE

CODE

DEL

DFN

EM

I

KBD

LISTING

P

PLAINTEXT

PRE

RT

RUBY

S

SAMP

SMALL

STRIKE

STRONG

SUB

SUP

TT

U

VAR

 

However, other text-handling elements, such as the Internet Explorer <MARQUEE> element, have additional capabilities beyond the core properties, methods, and events; and I'll take a look at them in this chapter in depth.

While on the subject of working with text in web pages, we'll also take a look at using text ranges in this chapter, including the Internet Explorer TextRange and selection objects, as well as the Netscape Navigator Range and selection objects. After you associate a text range with a section of text in a web page, you can work with that text using JavaScript, much as you would work with text in your program using String objects. The text range objects we'll see in this chapter are getting bigger and bigger with each new browser release, and we'll get a handle on them here. We'll also take a look at handling text in web pages in terms of W3C text nodes.

I'll start now by taking a look at the text-handling HTML elements that have capabilities beyond JavaScript's core HTML properties, methods, and events. Some of these elements, such as <BLOCKQUOTE> coming up next , aren't the most exciting HTML elements ever, but we'll cover them for completeness.



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net