Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colour in Image Map

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Hi Folks,

I have a map of Ireland on a website and I have information stored in a DB for certain counties. The image is broken down by counties using an image map and you can click on a county to view the information relating to that county.

I was wondering if it would be possible to colour in a particular county on the fly using HTML/CSS/javascript if there was information for that county in the DB. Would that be possible?? I have given each area tag an ID the same as the name of the county. When I read the information from the DB, if I have a match in the DB for the area ID can I apply an overlay colour somehow??

Mighty
 

Unless you are fine restricting this to IE-only, where you could use VML, then the answer is no.

You would have to use some clever image swapping for this to be cross-browser, as you cannot have irregularly shaped areas being arbitrarily coloured in, AFAIK.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
You could do it with Javascript and some absolutely positioned images, but it wouldn't be straightforward.

Basically, in addition to your main map, you make a lot of little images of single counties coloured in, use absolute positioning to make them overlay their position in the main map and CSS to make them invisible. When the mouse is over an area, use Javascript to make the appropriate image visible.

Alternatively, maybe you can do something with the technique shown here:
-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top