给area标签添加红色边框
Posted zmc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了给area标签添加红色边框相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=gb2312"
/>
<
title
>无标题文档</
title
>
function getOffset(obj){
var x = obj.offsetLeft, y = obj.offsetTop;
while(obj.offsetParent){
obj = obj.offsetParent;
x += obj.offsetLeft;
y += obj.offsetTop;
}
return {x : x, y : y};
};
function showBorder(obj){
var img = document.getElementById("bd");
var div = document.getElementById("border");
var offset = getOffset(img);
var coords = obj.coords.split(",");
div.style.display = "block";
div.style.left = offset.x + parseInt(coords[0]) + "px";
div.style.top = offset.y + parseInt(coords[1]) + "px";
div.style.width = parseInt(coords[2]) - parseInt(coords[0]) + "px";
div.style.height = parseInt(coords[3]) - parseInt(coords[1]) + "px";
}
function hideBorder(){
document.getElementById("border").style.display = "none";
}
</
script
>
</
head
>
<
body
>
<
img
src
=
"http://www.baidu.com/img/baidu_logo.gif"
width
=
"270"
height
=
"129"
border
=
"0"
usemap
=
"#bdMap"
id
=
"bd"
/>
<
map
name
=
"bdMap"
id
=
"bdMap"
>
<
area
shape
=
"rect"
coords
=
"35,22,115,97"
onmouseover
=
"showBorder(this);"
onmouseout
=
"hideBorder()"
/>
<
area
shape
=
"rect"
coords
=
"158,26,238,94"
onmouseover
=
"showBorder(this);"
onmouseout
=
"hideBorder()"
/>
</
map
>
<
div
id
=
"border"
style
=
"display:none; position:absolute;border:2px solid #FF0000; "
></
div
>
</
body
>
</
html
>
以上是关于给area标签添加红色边框的主要内容,如果未能解决你的问题,请参考以下文章
HTML map标签area 属性,当鼠标移动到area上面的时候,对应的区域边框的的变大,前变色怎么办?谢谢啊
Python使用matplotlib可视化面积图(Area Chart)通过给坐标轴和曲线之间的区域着色可视化面积图在面积图的指定区域添加箭头和数值标签