图片设置热点链接

来源:互联网 发布:c语言9除以10的余数 编辑:程序博客网 时间:2024/05/22 23:36


<style type="text/css">
html, body {
 height: 100%;
}
#bg {
 z-index: -100;
 left: 0px;
 top: 0px;
 right: 0px;
 bottom: 0px;
 margin: 0px;
 padding: 0px;
}
#bgimg {
 width: 100%;
 height: 100%;
 margin: 0px;
 border-style: none;
}
</style>
<script type="text/javascript">

//<![CDATA[
window.onload = function() {
 if (!window.event) return;
 var bgimg = document.getElementById("bgimg");
 var orgHeight=452;
var orgWidth=1203;
var bgimg = document.getElementById("bgimg");
var baoming=document.getElementById("baoming");
var yzm=document.getElementById("yzm");
var bmtxt=document.getElementById("Layer1");
var yzmtxt=document.getElementById("Layer2");
 window.onresize = function() {
 bgimg.style.width = document.body.clientWidth + "px";
 bgimg.style.height = document.body.clientHeight + "px";
 var w=document.body.clientWidth;
 var h=document.body.clientHeight;
 var x1=334/orgWidth*w;//334,380,831,406是热点矩形框的的坐标点,orgWidth与orgHeight是获取热点时图片的大小
 var y1=380/orgHeight*h;
 var x2=831/orgWidth*w;
 var y2=406/orgHeight*h;
 baoming.coords=x1+","+y1+","+x2+","+y2;
 var x3=649/orgWidth*w;
 var y3=340/orgHeight*h;
 var x4=1025/orgWidth*w;
 var y4=367/orgHeight*h;
 yzm.coords=x3+","+y3+","+x4+","+y4;
 };
 window.onresize();
};
//]]>
</script>
</head>

<body>
<img src="鲜奶活动界面/送奶活动2.jpg" name="bgimg" usemap="#Map" id="bgimg" >
<map name="Map">
  <area shape="rect" id="baoming"  href="#">
  <area shape="rect" id="yzm"  href="#">
</map>
</body>

0 0
原创粉丝点击