• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Image Basics

Chapter 4. Image Basics

One of the best uses of JavaScript is to add visual interest to Web pages by animating graphics, and that's what this chapter is all about. Making an image on a Web page change when the user moves the mouse over the image, thereby making the page react to the user, is one of the most common—and effective—tricks you can learn in JavaScript. This rollover, as it is called, is easy to implement, yet has many applications, as you'll see.

In this chapter, you'll learn several ways to implement rollovers on your pages, and how to use functions to make coding multiple rollovers easier.

Table 4.1. Just Enough HTML—Images
TAGATTRIBUTEMEANING
img Contains the attributes that describe the image to be displayed by the browser
 srcContains the URL of the image, relative to the URL of the Web page
 widthContains the width (in pixels) at which the browser will display the image
 heightContains the height (in pixels) at which the browser will display the image
 borderThe width of the border to be displayed when the image is also a link
 nameThe name that JavaScript uses to refer to this image; as with other JavaScript objects, no spaces or otherpunctuation is allowed, and it cannot start with a number
 altUsed for non-visual browsers in place of the image
 hspaceA horizontal buffer area around the image
 vspaceA vertical buffer area around the image
 usemapThe map tag that this image references
 alignDescribes where this image should be placed on the page in terms of horizontal or -vertical alignment


  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint