想在鼠标悬停在 map 的任何区域时加载不同的图像。
<img src="images/mapimg.png" usemap="#states" />
<map name="states">
<area shape="poly" coords="4,349,121,416,111,205" title="test1">
<area shape="poly" coords="226,287,234,255,132,231,129,402,151,404,150,429,362,465,362,385,283,359" title="test" />
</map>
最佳答案
改进空间很大,但基本喜欢
<img id="map" src="images/mapimg.png" usemap="#states" />
<map name="states">
<area style="background-color: black;" onmouseover="document.getElementById('map').src = 'other.png';" shape="poly" coords="4,349,121,416,111,205" title="test1">
<area shape="poly" coords="226,287,234,255,132,231,129,402,151,404,150,429,362,465,362,385,283,359" title="test" />
</map>
关于javascript - 想要在区域悬停时更改图像源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26784503/