Java/Javascript imagemaps...

xirtam

Diamond Member
Aug 25, 2001
4,693
0
0
Let's say you've got a picture of North America and you need polygons to imagemap the countries so that the onMouseOver event highlights, filters, changes the color, etc. of the country. What's the best way to do that? Applet, or is there a way to do it in pure Javascript? Anyone know anything about SVG? Is that the way to go? Code examples? All I can find premade uses rectangles as hotspots... this is unacceptable. Probably going to have to write my own applet, but thought I'd check here to see if this particular wheel has already been invented.

Thanks.
 

colonelR

Junior Member
Mar 11, 2002
17
0
0
Don't panic - you can do it with hotspots. Instead of area shape = rect try using area shape=poly as below:

<area shape="poly" coords="x,y,x1,y1,x2,y2,x3,y3" href="#">

x & y are the coordinates for each point on the hotspot/polygon and are measured according to the image your using (i.e. N.America)

You can add as many coordinates as you like (well - I've never reached a limit!)

Good luck
 

xirtam

Diamond Member
Aug 25, 2001
4,693
0
0
Yeah, but does this allow me to highlight the region under the polygon? I don't think it does... does anyone know of any javascript that will just draw a filled polygon or perhaps do some kind of filter to set this region apart from the rest of the image? I don't want to load a new graphic for every region...