HTML and CSS Reference
In-Depth Information
automated treatment, to change the contents' display characteristics
(
class
,
style
), to reference the language (
lang
) used, and to specify the
direction in which the text should flow (
dir
). And, of course, there are all
the user events that may happen in and around the tagged contents that
the browser senses and that you may react to via an on-event attrib-
ute and some programming. [
Inline Styles: The style Attribute, 8.1.1
]
Of these many HTML 4 and XHTML attributes,
id
is the most important.
It lets you label the image for later access by a program or browser op-
eration (see
Chapter 12
). [
The id attribute, 4.1.1.4
]
The remaining attributes have questionable meaning in context with
<img>
. Granted, a few stylesheet options are available that may influence
an image's display, and it's good to include a title (although
alt
is bet-
ter). However, it's hard to imagine the influence that language (
lang
) or
5.2.6.16. The name, onAbort, onError, onLoad, and other event
attributes
There are four
<img>
attributes originally supported by Netscape and
now by all the popular browsers that enable you to use JavaScript to
the
id
attribute,
name
lets you label the image so that a JavaScript applet
can reference it. For example:
[*]
HTML version 4.01 and XHTML have adopted the
name
attribute, too.
<img src="pics/kumquat.gif" name="kumquat">
lets you later refer to that picture of a kumquat as simply "kumquat" in
a JavaScript applet, perhaps to erase or otherwise modify it. You cannot