2014-11-03 64 views
0

如何在鼠標單擊圖像座標時生成信息文本或提示框?使用圖像映射的鼠標單擊提醒框

以下是映射代碼我試過行:

<area shape="rect" coords="523,137,658,160" href="#" onclick='alert("Pt.#xxxxx - $xxx.xx")' title="Pt.#xxxxx"> 
+2

你可能忘記與< and >包圍你的面積? – nicael 2014-11-03 15:51:37

回答

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>