html去图⽚热区边框,给图像热区加边框的通⽤⽅法function inArea(img){
var id = '_$area$_', pos = ds.split(','), area = ElementById(id);
if (area) outArea(area);
area = ateElement('a');
area.id = id, area.href = this.href, area.target = this.target, area._area = this;
pos[0] -= 0, pos[1] -= 0, pos[2] -= pos[0], pos[3] -= pos[1];
with (area.style) {
position = 'absolute';
left = img.offsetLeft + pos[0] - 1;
top = img.offsetTop + pos[1] - 1;
width = pos[2];
height = pos[3];
border = '1px solid #ff0000';
}
document.attachEvent ? this.parentNode.appendChild(area) :
placeChild(area, this);
}
function outArea(elem){
document.attachEvent ? veChild(elem) :
placeChild(elem._area, elem);
}
var map, areas, j, i = 0, imgs = document.images;
for (; i < imgs.length; i++) {
map = imgs[i].useMap;
html图片展示特效
if (map) if (map = ElementById(map.slice(1))) {
areas = ElementsByTagName('area');
for (j = 0; j < areas.length; j++)
areas[j].onmouseover = (function(img){
return function(){ inArea.call(this, img); }
})(imgs[i]);
}
}; }

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。