鼠标事件

来源:互联网 发布:丁鹏 量化投资 源码 编辑:程序博客网 时间:2024/04/29 15:07
<!DOCTYPE html>
<html>
<body>


<div 
onmousedown="mDown(this)" 
onmouseup="mUp(this)" 
onmouseover="mOver(this)"
onmouseout="mOut(this)"
style="background-color:#D94A38;width:200px;height:50px;padding-top:25px;text-align:center;">
点击这里
</div>


<script>
function mDown(obj)
{
obj.style.backgroundColor="#1ec5e5";
obj.innerHTML="鼠标按下"
}


function mUp(obj)
{
obj.style.backgroundColor="#D94A38";
obj.innerHTML="鼠标松开"
}
function mOver(obj)
{
obj.innerHTML="鼠标在上面";
}
function mOut(obj)
{
obj.innerHTML="鼠标离开";
}
</script>


</body>
</html>
0 0
原创粉丝点击