您的位置:首页 > 其它

focus()获取焦点和blur()失去焦点事件

2014-07-30 10:29 393 查看
<html>

<head>

<style type="text/css">

a:active {color:green}

</style>

<script type="text/javascript">

function getfocus()

{document.getElementById('myAnchor').focus()}

function losefocus()

{document.getElementById('myAnchor').blur()}

</script>

</head>

<body>

<a id="myAnchor"

href="http://www.w3school.com.cn">Visit W3School.com.cn</a>

<br /><br/>

<input type="button" onclick="getfocus()" value="Get focus">

<input type="button" onclick="losefocus()" value="Lose focus">

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: