Chapter 21Images and Graphics

Defining Images in HTML

Without images web pages would be pretty dull. In fact, it is hard to imagine a modern web site without graphics. Inserting images into HTML is very simple. However, the images inserted via HTML simply sit there; they don’t do anything dynamic. Thankfully, adding that dynamic behavior with JavaScript is not a difficult task. The syntax to define an image in HTML is as follows:

<IMG   [NAME="imageName"]   SRC="Location"   [LOWSRC="Location"]   [HEIGHT="Pixels" | "Value"%]   [WIDTH="Pixels" | "Value"%]   [SPACE="Pixels"]   [BORDER = "Pixels"]   [ALIGN = "left" | "right" |"top" | "absmiddle" | "absbottom"            |"texttop" | "middle" | "baseline" | "bottom" ]   [ISMAP]   [USEMAP="Location#MapName"]   [onAbort="handlerText ...

Get Advanced Javascript, 3rd 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.