LEARNING JAVASCRIPT - Trang 283

Figure 18-1. DOM tree

For the following examples, we’ll use a very simple HTML file to demonstrate these

features. Create a file called simple.html:

<!

doctype

html

>

<

html

>

<

head

>

<

meta

charset

=

"utf-8"

>

<

title

>

Simple

HTML

<

/title>

<

style

>

.

callout

{

border

:

solid

1

px

#

ff0080

;

margin

:

2

px

4

px

;

padding

:

2

px

6

px

;

}
.

code

{

background

:

#

ccc

;

margin

:

1

px

2

px

;

padding

:

1

px

4

px

;

The Document Object Model | 259