javascript onmousedown、onmouseup练习代码

<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
</head>
<body>
<div id="mouse" style="background-color: #33cccc;width: 200px;height: 200px;"
     onmousedown='over(this)' onmouseup='out(this)'>请把鼠标按下去</div>

<script>
    function over(obj) {
        obj.innerHTML = "松开鼠标";
    }
    function out(obj) {
        obj.innerHTML = "按下鼠标";
    }
</script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_45949073/article/details/107961584