Title: Image Maps
1Image Maps
2What is an ImageMap?
- You already know how to create a set of
individual images that are links. - Image maps are more sophisticated imagery that
enable the image to react to the position of the
mouse within the image so that different parts of
one image can each represent a different link.
3Examples
- A home page contains a picture of a companys
building. - The user can click on different parts of the
building image to obtain information about
different departments housed in that building.
4Example Defined Block Areas
5Example - Image Map Button Bars
6Example Physical Maps
7Example Product Parts
Filter Link
Coffee Pot Link
Base Unit Link
8Example Online Ordering
Bookends
How To Books
Reference Books
9Example Book Analogy
- A home page contains a picture of a bookshelf.
- The user can click on each book to link to a
different HTML file.
10Two Types of ImageMaps
- Server-side
- The map file with coordinate info is housed on
the server The server looks up the info and
returns the URL to the browser. - Client-side
- The map file containing coordinate info and links
is part of the HTML file These run more quickly,
but are not supported by older browsers.
11Client-side Image Maps
- Image Maps are a nice feature, but they require a
significant amount of labor to set up and code. - Not all images are appropriate have obvious
visual sections - Since client-side image maps can be set up
without special access to a server, we will code
this type.
12 Attribute Required
-
- Identifies the image source
BORDER0
Sample
13 Attribute Required
- Must identify which map to use USEMAP
Client maps - USEMAP map_name
BORDER0USEMAPmap_name
Sample
14Defining the MAP Code
- .......
- opening and closing tags
- All hotspots are nested within a MAP tag
-
- Defines each mouse-sensitive area (clickable
area hotspot) and what to do if clicked on - AREA - codes are place inside the opening and
closing MAP tags - 1 Area for each hotspot
15MAP NAME Attribute
16AREA Code Attributes
- HREFa.htm ALT Go to the first page
17AREA Attributes
- HREF
- Describes the document to be displayed when the
user clicks - Relative or Absolute URL is supported
- SHAPE
- Describes the general shape of the hot spot
- 3 shapes circle, rectangle, polygon
- COORDS
- Describes the boundaries of the hot spot
- Each entry is an x, y coordinate pair
- ALT
- Alternative Text for browsers that dont support
images
18Coordinate Pairs (X, Y)
- Rectangle
- Requires 2 sets of coordinates
- x, y (pixel on graphic) for top left corner
- x, y (pixel on graphic) for bottom right corner
- Circle
- Requires coordinates for center and radius
- Polygon
- Requires coordinates for each vertex (point)
19Coordinates for Rectangle Polygons
Rectangle Top, Left
Polygon 5 points
20Coordinates for a Circle
Circle Center Point (388, 154)
Radius Calculate Center X axis (388,
154) Border Xaxis (459, 154) (459-388) 71
21Sample Code
-
-
- 25,10,125,50
- SHAPErect COORDS 320,65,420,80
22Procedure to Use an ImageMap
- 1. Decide on graphic to use for image map
- 2. Decide on .htm files to display when hot
spots are clicked - 3. Outline hot spots and find COORDS in program
such as Photo Editor or Photoshop - 4. Define ...
- 5. Include USEMAP attribute in IMG tag of
original graphic
231. Image Selection
- Better to have visual indicators where to click
241. Selected Graphic (Sample)
252. Determine Files to Display
- Hnbch.htm
- Maui.htm
- Ftlaud.htm
26Determining X, Y Coordinates
- Programs Photo Editor, PhotoShop, FrontPage
(0,0)
(15, 190)
(320, 174)
27Determining X, Y Coordinates
(2, 164)
(124, 360)
284. Create the HTML Page
- Open Notepad
- Add the basic HTML tags
- Insert the image
Your name Lab
4-1 FACE"BAZOOKA" color"FF8429"SURF'S UP
LOCATIONS
294. Add the MAP Code
- Make sure to specify the shape, coords, href,
and alt attributes
305. Modify the Image Tag
- Modify the tag to use the ImageMap
- Use the USEMAP attribute
31Test the page!
- View the page in a browser
- Note the links are displayed in the status bar
- Test the links
32Procedure Review
- 1. Decide on graphic to use for image map
- 2. Decide on .htm files to display when hot
spots are clicked - 3. Outline hot spots and find COORDS in program
such as Photo Editor or Photoshop - 4. Define ...
- 5. Include USEMAP attribute in IMG tag for
original graphic - 6. Test the page!
33More Helpful Things
- True/False
- F
- T
- F
- F
- F
- T
- F
- F
- T
- F
- Multiple Choice
- a
- b
- d
- c
- b
- a
- c
- c
- b
- a
Keys to the End of Chapter Questions