djp1988 Posted July 5, 2008 Share Posted July 5, 2008 Here is my code: var onImgArray = new Array();onImgArray["LR"] = new Image(200,213);onImgArray["AUVERGNE"] = new Image(200,213);onImgArray["LR"].src = "languedoc-roussillon.gif";onImgArray["AUVERGNE"].src = "auvergne.gif";onImgArray["LR"].name = "Languedoc-Roussillon";onImgArray["AUVERGNE"].name = "Auvergne";function imageOn(imgName) { if (document.images) { document.images["france"].style.cursor = "pointer"; document.images["france"].src = onImgArray[imgName].src; txt = onImgArray[imgName].name; region.innerHTML = txt; }} and my html: <img id="france" src="france.gif" width="200" height="213" border="0" usemap="#map" /> <map name="map" id="map"> <area shape="poly" onmouseover="imageOn('LR')" onmouseout="imageOff('FR')" coords="122, 195..." href="#" /> <area shape="poly" onmouseover="imageOn('AUVERGNE')" onmouseout="imageOff('FR')" coords="119..." href="#" /></map><p id="region"></p> I aim to display in the <p> id as region the name of the region of france what the user is hovering over, but my script doesn't work, why ?I'm sure it's the .name that isn't correct, but I don't know what to name this attribut containing the name...Please help Link to comment Share on other sites More sharing options...
shadowayex Posted July 6, 2008 Share Posted July 6, 2008 Try writing it document.getElementById("region").innerHTML = txt; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.