<a οnmοuseοver="mouseOver(this)" οnmοuseοut="mouseOut(this)">鼠标放在上面就知道了</a>
js代码:
<script type="text/javascript">
function mouseOver(o) {
o.style.backgroundColor = "red";
}
function mouseOut(o) {
o.style.backgroundColor = "blue";
}
</script>
<div id="test" style="border:1px solid red;">移动上来</div>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}
$('test').οnmοuseοver=function(){
this.style.border = '1px solid #006699';
}
$('test').onmouseout = function(){
this.style.border = '1px solid #FF0000';
}
</script>