focus焦点管理

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>focus</title>
<script type="text/javascript">
    window.onload = function() {
        var button = document.getElementById("myButton");
        button.focus();
        alert(document.activeElement === button);
    }
</script>
</head>
<body>
    <button type="button" id="myButton">Click Me!</button>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_42740745/article/details/84260273
今日推荐