1
當用戶單擊地圖的一部分時,我嘗試獲取此部分的ID。Html地圖對象 - 點擊地圖的一部分獲取ID
<img src="images/mapa.png" alt="" width="588" height="711" usemap="#Map" />
<map name="Map" class="map">
<area shape="circle" id="vrsac" coords="317,191,25" href="#">
<area shape="circle" id="pancevo" coords="273,225,25" href="#">
<area shape="rect" id="beograd" coords="195,247,251,276" href="#">
<area id="lazarevac" shape="rect" coords="204,283,267,318" href="#">
</map>
$(document).ready(function(){
$(".map").click(function() {
alert("Click: " + this.id);
});
});
感謝
解決
我添加類區域標記。
<area class="qwe" shape="circle" id="vrsac" coords="317,191,25" href="#">