图像地图不适用于FF& IE(带onclick javascript)

时间:2012-08-16 16:53:46

标签: javascript imagemap

对于我的生活,这不起作用,我无法弄清楚为什么..

<div class="b2s-popup" id="hideaway">
<img src="back-in-groove.jpg" usemap="b2schoolpop" />
<map name="b2schoolpop" id="b2schoolpop">
  <area shape="rect" coords="304,289,403,308" href="#" />
  <area shape="rect" coords="365,-6,426,24" href="javascript:;" onClick="document.getElementById('hideaway').style.display='none';" />
</map>
</div>

2 个答案:

答案 0 :(得分:1)

我是个白痴。 Usemap应该是“#b2schoolpop”而不是“b2schoolpop”

答案 1 :(得分:0)

试试这个;

<div class="b2s-popup" id="hideaway">
<img src="back-in-groove.jpg" usemap="b2schoolpop" />
<map name="b2schoolpop" id="b2schoolpop">
  <area shape="rect" coords="304,289,403,308" href="#" />
  <area shape="rect" coords="365,-6,426,24" href="javascript:document.getElementById('hideaway').style.display='none';" />
</map>
</div>

或者

<div class="b2s-popup" id="hideaway">
<img src="back-in-groove.jpg" usemap="b2schoolpop" />
<map name="b2schoolpop" id="b2schoolpop">
  <area shape="rect" coords="304,289,403,308" href="#" />
  <area shape="rect" coords="365,-6,426,24" href="javascript:void(0);" onclick="javascript:document.getElementById('hideaway').style.display='none';" />
</map>
</div>