再动态向<map>添加一个<area>
把鼠标分别放到图片的左上角和中间,是不是你要的效果?
<body>
<img src="mymap.jpg" border="0" usemap="#mymap" style="width:100pxheight:100px"/>
<map name="mymap" id="mymap">
<area
shape="circle"
coords="50,50,15"
href ="#"
target ="_blank" alt="x:50,Y:50,半径:15" />
<area
shape="rect"
coords="0,0,15,15"
href ="http://www.baidu.com"
target ="_blank"
alt="跳至百度" />
</map>
</body>
<a onclick='addimg()'>添加图片</a><div class='addimg'></div>
<script>
var i=0,div=document.getElementsByTagName("div")[0]
function addimg(){
var input=document.createElement("input")//创建input
input.setAttribute("type","file")//设置type属性
input.setAttribute("name","a"+(++i))//设置name属性
div.appendChild(input)//插入到div内
}
</script>
js点击事件原图片替换‘钩’图片<script type="text/javascript">
function click(){
document.getElementById('id').src='b.jpg'
}
</script>
<img src="a.jpg" id="img" onclick="click()"/>
a.jpg原图片b.jpg‘钩’图片
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)