I'm sure there's a better way to do this -- and I'm not sure Crazy exactly how to set it up with your suggestion -- though its probably effecive.
What I did was as follows:
First stored the ImageMap (string) in a Java Function, q.v.,
function changeText(theSpan,text){
if(text=="MO1"){
document.getElementById(theSpan).innerHTML = "<area shape='rect' coords='62,23,79,32' OnMouseOver='openWinA()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,34,83,43' OnMouseOver='openWinB()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,45,83,54' OnMouseOver='openWinC()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,56,84,65' OnMouseOver='openWinD()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,67,83,76' OnMouseOver='openWinE()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,78,83,87' OnMouseOver='openWinF()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,89,81,98' OnMouseOver='openWinG()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,100,81,109' OnMouseOver='openWinH()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,111,84,120' OnMouseOver='openWinI()' onMouseOut='closeWin()'>"
document.getElementById(theSpan).innerHTML += "<area shape='rect' coords='62,122,83,131' OnMouseOver='openWinJ()' onMouseOut='closeWin()'>";
}
To trigger this Java routine I had the following mouse over java attached to my heading links (heading links, 7 of them, appears under an image. When you mouse over one of the headings a new chart pops up from mouse over -- trick was to get the new ImageMap in place at the same time.
This was done by changing the text in a "span" element. On mouse over of the chart heading:
<asp:HyperLink Text="AWW" runat="server" onMouseOver="MM_swapImage('Image1',','/icaae/images/MO1.png',1);changeText('theSpan','MO1')"/>
Then the span was placed within the ImageMap iteself:
<img src='images/MO1.png' name="Image1" width="380" height="200" border="0" usemap="#map1">
<map name="map1">
<span id="theSpan" style="visibility: hidden">'<%=strMap%>'</span>
</map>
The <%=strMap%> call is the "first" ImageMap that I want loaded, in the Page Load event I populated the string variable strMap with this string and sent it to the span element.
...that's it. Only took 1 day to get this right.
My first image has a legend, the legend titles are java senstive (mouse over). When you change to other images, the ImageMap is reduced to "".
If you want to see an example go to:
http://frontpage.auburn.edu/icaae/index.aspx