10.2. The basic structure of an image map script
Prev | Chapter 10. Using CSIM (Client side image maps) | Next

## 10.2. The basic structure of an image map script

The basic structure for a HTML page using client side image maps will have the following layout

    // Image map specification with name "mapname"
    <MAP NAME=...>
    ... specification ...
    </MAP>

    // Image tag
    <img src="..." ISMAP USEMAP="mapname">

This poses an interesting question. Since we normally call the graphing script directly in the <img> tag how do we get hold of the image map (which is available only in the image script) in this "HTML wrapper" script?

In JpGraph there is actually two ways of solving this.

1. Use the preferred "builtin" way using the modified `Stroke()` method `StrokeCSIM()` instead of the standard `Graph::Stroke()` method.

2. Directly use the `Graph::GetHTMLImageMap()` which gives you fine control at the expense of more complex coding. This is necessary if several image map graphs are needed on the same page.

The first (and preferred) way modifies the stroke method so that instead of returning an image (like the standard `Stroke()` method) `StrokeCSIM()` actually returns an HTML page containing both the image map specification and the correct`<IMG>` tag.

This means that it is necessary to treat an image map returning image script differently from a non-CSIM image script, for example it is not posible to use it directly as the target for the "`src`" attribute of the <IMG> tag since it sends back a HTML page containing both an image tag together with an image map.

Prev | Up | Next
Chapter 10. Using CSIM (Client side image maps) | Home | 10.3. Specifying targets for image map plots