如何在鼠标单击图像坐标时生成信息文本或警告框?
以下是我尝试的映射代码行:
<area shape="rect" coords="523,137,658,160" href="#" onclick='alert("Pt.#xxxxx - $xxx.xx")' title="Pt.#xxxxx">
答案 0 :(得分:0)
试试此代码
http://jsfiddle.net/rainerpl/157wq0zq/
click on planets or the sun ( sample from w3schools )<br>
<img src="http://www.w3schools.com/tags/planets.gif" width="145" height="126" alt="Planets"
usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="javascript: alert('the sun')" alt="Sun" >
<area shape="circle" coords="90,58,3" href="javascript: alert('the mercury')" alt="Mercury">
<area shape="circle" coords="124,58,8" href="javascript: alert('the venus')" alt="Venus">
</map>