87,910
社区成员
发帖
与我相关
我的任务
分享
//热区层
<div id="HotAreaDiv" style="z-index:1" filter:alpha(opacity=0)>
<img src="resources/A.jpg" width="800" height="560" border="0" usemap="#map" style="filter:alpha(opacity=0) z-index:1">
<map name="map" id="map" >
<area shape="poly" id="NO1Dinner" coords="210,496,10" onMouseOver="showtrail('NO1dinner')" style="border: 1px solid rgb(119,119, 119);" onMouseOut="hidetrail()">
...
<area shape=""...>
</map>
<div>
//背景图片层:该层图片为动态填充的
<div id="ImgDiv" style="z-index: 0">
</div>
<html >
<head>
<script type="text/javascript">
function abc(){
hotimg= document.createElement("img"); //添加图片
hotimg.src="img/1.jpg";
hotimg.usemap="#Map1";
hotimg.setAttribute("id", "himg");
document.getElementById('mask').appendChild(hotimg);
hotarea=document.createElement("map"); //添加map标签
hotarea.name="Map1";
hotarea.setAttribute("id","harea");
document.getElementById('mask').appendChild(hotarea);
area_a=document.createElement("area"); //添加热区
area_a.shape="circle";
area_a.coords="262,437,80";
area_a.href="#";
area_a.setAttribute("id", "area_1");
document.getElementById('harea').appendChild(area_a);
}
</script>
</head>
<div id="mask">
<input type="button" value="set" onclick="abc()">
</div>
</html>