Inside JavaScript

The <OL> Element: Ordered Lists

You create ordered lists, which display numbered or lettered items, with the <OL> element. (Note that we just saw such a list in Listing 14.3.) You create each item in the list with an <LI> element. Here's an example that displays such a list:

(Listing 14-06.html on the web site)

<HTML> <HEAD> <TITLE> An Ordered List </TITLE> </HEAD> <BODY> <H1> Creating An Ordered List </H1> Buying a computer? Let's consider: <OL> <LI> Price <LI> CPU Speed <LI> Memory <LI> Disk space <LI> CD-ROM/DVD speed </OL> </BODY> </HTML>

You can see the results in Figure 14.2.

Figure 14.2. Using an ordered list.

You can find the JavaScript properties for the <OL> element in Table 14.3. Remember that JavaScript's core HTML properties, methods , and events, which we covered in Chapters 5 and 6, apply to this element as well.

Table 14.3. The Properties of the <OL> Element (See Chapters 5 and 6 for the JavaScript core HTML properties, methods, and events that also apply to this element.)

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

compact

     

x

   

x

x

x

x

 

Read/write

 

Supposedly affects the spacing of the text and the list numbering/ bulleting, but in fact has no effect. The COMPACT attribute is deprecated in HTML 4.01.

start

     

x

   

x

x

x

x

 

Read/write

 

Sets or gets the starting number for an ordered list. This is the number you want the list numbering to begin with. Set to a string.

type

     

x

   

x

x

x

x

 

Read/write

 

Specifies the type of list item label; set to "A" (capital letters ), "a" (lowercase letters), "I" (large roman numerals), "i" (small roman numerals), "1" (default numbering scheme). Deprecated in HTML 4.01.

Категории