
如果需要发生改变热点区域颜色,那是没有好办法的,但是有巧办法,利用JavaScript来改变图片,使用onmouseover事件和onmouseout事件在改变图片的src
例子:
<img
src="header.jpg"
width="800"
height="202"
border="0"
usemap="#Map"
id="headerImg"
/>
<map
name="Map"
id="Map">
<area
shape="rect"
coords="452,97,554,145"
href="#"
onmouseover="document.getElementById('headerImg').src='header1.jpg'"/>
</map>
<img src="32.jpg" width="400" usemap="#map1"><!-- usemap 指使用映射的名称(或 ID),map1 对应下面 <map> 的 name 或 id 的值-->
<map name="map1" id="map1">
<!-- map 的 name 和 id 指映射的名称(或 ID),值可以自己设置,比如 "map1" 或 "yingshe" 等等,而你使用的 "map" 也行,但这样容易产生混淆,所以一般不这样写 -->
<area shape="circle" coords="120,130,14" href ="1.html">
<area shape="rect" coords="0,0,110,260" href ="2.html">
</map>
<img>中的 usemap="#map1" 是要使用的映射的名称(或 ID),对应 <map>中的 name=“map1” 或 id=“map1”,但前面要加一个“#”。
至于 <map>的 name 和 id ,效果一样,其实只要设置一个 name 即可,但为了保证兼容性,最好两个都写,且值也要一样。
<html><body>
<!--在一个大图像上划分成几个热点区域,每个热点区域可以连接到不同网站-->
<img src="http://img.china.alibaba.com/img/ibank/2015/843/880/2478088348_245582884.jpg" width="950" height="570" border="0" usemap="#Map" /><!-usemap在这里-->
<map name="Map" id="Map">
<area shape="rect" coords="0,1,472,283" href="http://detail.1688.com/offer/520846933943.html" target="_blank"/>
<area shape="rect" coords="472,2,952,283" href="http://detail.1688.com/offer/520850588936.html" target="_blank"/>
<area shape="rect" coords="1,283,478,573" href="http://detail.1688.com/offer/620828112.html" target="_blank"/>
<area shape="rect" coords="472,283,952,683" href="http://www.kukeduo.COM" target="_blank"/>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)