...javascript,给元素添加事件,当mouseOver时就添加边框,mouseout时消失...
发布网友
发布时间:2022-05-01 18:50
我来回答
共3个回答
热心网友
时间:2022-04-24 20:42
<script>
window.onload = function(){
var el = document.getElementById('元素ID');
el.onmouseover = function(){
el.style.border = 'solid 1px red';
};
el.onmouseout = function(){
el.style.border = '';
}
}
</script>
热心网友
时间:2022-04-24 22:00
<script type="text/javascript">
function ShowBorder(a)
{
a.style.border = "1px solid black";
}
function HideBorder(a)
{
a.style.border = "0px";
}
</script>
<div onmouseover="ShowBorder(this)" onmouseout="HideBorder(this)">测试</div>
热心网友
时间:2022-04-24 23:35
这个需要用到document对象中得方法的,你可以找找文档....