blur() 方法用于把键盘焦点从该元素上移开。
textareaObject.blur()
下面的例子设置并移开了文本框上的焦点:
<html> <head> <script type="text/javascript"> function setFocus() {document.getElementById('txt1').focus()
} function loseFocus() {document.getElementById('txt1').blur()
} </script> </head> <body> <textarea id="txt1">Hello world....</textarea> <br /> <input type="button" onclick="setFocus()" value="Set focus" /> <input type="button" onclick="loseFocus()" value="Lose focus" /> </body> </html>