给div设置blur事件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .box{
            width: 200px;
            height: 200px;
            background-color: #3295F2;
        }
    </style>
</head>
<body>
    <div class="box" id="box" tabindex="1"></div>
    <script>
        document.getElementById('box').onblur = function(){
            alert('div blur');
        };
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/kongjiea/article/details/53173956
今日推荐