rherna01
09-08-2006, 07:33 PM
I am trying to highlight areas on an Image Map "ONMOUSEOVER." I have a JavaScript that will remove the area from the map, but I can't change the color of the area. This is my script:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var curFocus = null;
function areaFocus() {
// Track the last Area element selected.
if ("New York" == event.srcElement.id)
curFocus = event.srcElement;
}
function colorArea() {
// Remove an Area element.
var coll = document.all.territories.areas;
if (null != curFocus) // Make sure one is selected.
// Loop over Area elements and find the one selected.
for (var intLoop = 0; intLoop < coll.length; intLoop++)
if (curFocus == coll[intLoop]) {
document.all.territories.areas.remove(intLoop);
//this removes (not what i want to do)
return;
}
}
</SCRIPT>
My map looks liek this:
<img src=
"/images/usa_politcal_map.gif"
border="0"
usemap="#territories"> <map name="territories" ONMOUSEOVER="areaFocus()">
<area shape="poly"
coords=
"506,72,502,73,498,74,492,76,484,84,485,85,482,87,479,91,480,92,482,92,482,96,483,96,483,98,481,99,47 9,101,477,103,474,103,473,105,469,103,465,103,462,104,459,105,457,107,457,109,457,111,459,111,460,11 2,459,115,456,118,455,119,452,121,451,122,453,124,455,124,462,124,467,122,471,121,478,120,482,119,48 8,118,493,117,496,117,498,118,499,120,501,122,502,123,503,123,506,124,507,124,510,125,511,125,513,12 6,515,126,515,128,517,129,513,130,516,133,521,133,526,132,530,129,532,127,534,125,533,122,530,122,52 8,122,526,123,524,123,524,124,523,125,522,126,519,127,518,129,516,128,514,126,514,124,515,123,515,12 0,515,118,513,116,514,112,513,111,512,108,512,104,511,92,509,91,508,86,509,83,509,81"
href="/contacts/ny.asp"
id="New York"
title="New York"
OnMouseOver="colorArea()"
alt="New York">
<map>[/SIZE]
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var curFocus = null;
function areaFocus() {
// Track the last Area element selected.
if ("New York" == event.srcElement.id)
curFocus = event.srcElement;
}
function colorArea() {
// Remove an Area element.
var coll = document.all.territories.areas;
if (null != curFocus) // Make sure one is selected.
// Loop over Area elements and find the one selected.
for (var intLoop = 0; intLoop < coll.length; intLoop++)
if (curFocus == coll[intLoop]) {
document.all.territories.areas.remove(intLoop);
//this removes (not what i want to do)
return;
}
}
</SCRIPT>
My map looks liek this:
<img src=
"/images/usa_politcal_map.gif"
border="0"
usemap="#territories"> <map name="territories" ONMOUSEOVER="areaFocus()">
<area shape="poly"
coords=
"506,72,502,73,498,74,492,76,484,84,485,85,482,87,479,91,480,92,482,92,482,96,483,96,483,98,481,99,47 9,101,477,103,474,103,473,105,469,103,465,103,462,104,459,105,457,107,457,109,457,111,459,111,460,11 2,459,115,456,118,455,119,452,121,451,122,453,124,455,124,462,124,467,122,471,121,478,120,482,119,48 8,118,493,117,496,117,498,118,499,120,501,122,502,123,503,123,506,124,507,124,510,125,511,125,513,12 6,515,126,515,128,517,129,513,130,516,133,521,133,526,132,530,129,532,127,534,125,533,122,530,122,52 8,122,526,123,524,123,524,124,523,125,522,126,519,127,518,129,516,128,514,126,514,124,515,123,515,12 0,515,118,513,116,514,112,513,111,512,108,512,104,511,92,509,91,508,86,509,83,509,81"
href="/contacts/ny.asp"
id="New York"
title="New York"
OnMouseOver="colorArea()"
alt="New York">
<map>[/SIZE]