定义和用法
blur() 方法用于从链接上移开焦点。
语法
anchorObject.blur()
实例
1<html>
2<head>
3<style type="text/css">
4a:active {color:green}
5</style>
6
7<script type="text/javascript">
8function getfocus()
9{document.getElementById('myAnchor').focus()}
10
11function losefocus()
12{document.getElementById('myAnchor').blur()}
13</script>
14</head>
15
16<body>
17<a id="myAnchor"
18href="http://www.w3school.com.cn">Visit W3School.com.cn</a>
19<br /><br/>
20<input type="button" onclick="getfocus()" value="Get focus">
21<input type="button" onclick="losefocus()" value="Lose focus">
22</body>
23
24</html>
25
2<head>
3<style type="text/css">
4a:active {color:green}
5</style>
6
7<script type="text/javascript">
8function getfocus()
9{document.getElementById('myAnchor').focus()}
10
11function losefocus()
12{document.getElementById('myAnchor').blur()}
13</script>
14</head>
15
16<body>
17<a id="myAnchor"
18href="http://www.w3school.com.cn">Visit W3School.com.cn</a>
19<br /><br/>
20<input type="button" onclick="getfocus()" value="Get focus">
21<input type="button" onclick="losefocus()" value="Lose focus">
22</body>
23
24</html>
25