Javascript 图像映射onclick问题
嗨,伙计们,我对代码有问题: $gotobikeblue.clickfunction{ $bikeblue.show; $motor.hide; $wheel.hide; 返回false; }; $gotomotor.clickfunction{ $bikeblue.hide; $motor.show; $wheel.hide; 返回false; }; $gotowheel.clickfunction{ $bikeblue.hide; $motor.hide; $wheel.show; 返回false; }; 比克蓝 { 显示:无; } 轮 { 显示:无; }Javascript 图像映射onclick问题,javascript,html,image,dictionary,imagemap,Javascript,Html,Image,Dictionary,Imagemap,嗨,伙计们,我对代码有问题: $gotobikeblue.clickfunction{ $bikeblue.show; $motor.hide; $wheel.hide; 返回false; }; $gotomotor.clickfunction{ $bikeblue.hide; $motor.show; $wheel.hide; 返回false; }; $gotowheel.clickfunction{ $bikeblue.hide; $motor.hide; $wheel.show; 返回f
这似乎与具有相同ID的多个元素有关 如果我将重复的ID更改为类,页面将不再为我重新加载:
$(".gotobikeblue").click(function(){
$("#bikeblue").show();
$("#motor").hide();
$("#wheel").hide();
return false;
});
$(".gotomotor").click(function(){
$("#bikeblue").hide();
$("#motor").show();
$("#wheel").hide();
return false;
});
$(".gotowheel").click(function(){
$("#bikeblue").hide();
$("#motor").hide();
$("#wheel").show();
return false;
});
以及HTML:
<img src="http://i62.tinypic.com/2l8jmzo.jpg" alt="" usemap="#motor" id="motor"/>
<map id="motor" name="motor">
<area class="gotobikeblue" alt="" title="" href="" shape="rect" coords="1135,13,1261,123" style="outline:none;" target="_self" />
<area class="gotowheel" alt="" title="" href="" shape="rect" coords="1110,874,1265,997" style="outline:none;" target="_self" />
</map>
<img src="http://i62.tinypic.com/14kv6zo.jpg" alt="" usemap="#bikeblue" id="bikeblue"/>
<map id="bikeblue" name="bikeblue">
<area class="gotomotor" alt="" title="" href="" shape="rect" coords="10,9,103,92" style="outline:none;" target="_self" />
<area class="gotowheel" alt="" title="" href="" shape="rect" coords="899,666,1010,756" style="outline:none;" target="_self" />
</map>
<img src="http://i58.tinypic.com/2qvw12x.jpg" alt="" usemap="#wheel" id="wheel"/>
<map id="wheel" name="wheel">
<area class="gotomotor" alt="" title="" href="" shape="rect" coords="13,12,164,109" style="outline:none;" target="_self" />
<area class="gotobikeblue" alt="" title="" href="" shape="rect" coords="35,130,127,210" style="outline:none;" target="_self" />
</map>
哇,我大概有8年多没见过图像地图了。