buliangniu 发表于 2013-2-7 17:32:31

focus() 和blur()用法

<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"value="获得焦点" />    <input type="button"value="失去焦点" /></body></html> 
页: [1]
查看完整版本: focus() 和blur()用法