- <html>
- <head>
- <title>focus()和blur()用法</title>
- <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://buliangniu.iteye.com">不良牛 buliangniu.iteye.com</a>
- <br />
- <br />
- <input type="button" οnclick="getfocus()" value="获得焦点" />
- <input type="button" οnclick="losefocus()" value="失去焦点" />
- </body>
- </html>
- focus():取得表单域的焦点;
blur():失去表单域的焦;
focus() 和blur()用法
最新推荐文章于 2022-03-08 09:34:06 发布