HTML DOM blur() 方法
定義和用法
blur() 方法用于從密碼域移開(kāi)焦點(diǎn)。
語(yǔ)法
passwordObject.blur()
實(shí)例
下面的例子可設(shè)置或返回密碼域的焦點(diǎn):
<html> <head> <script type="text/javascript"> function setFocus() {document.getElementById('password1').focus()
} function loseFocus() {document.getElementById('password1').blur()
} </script> </head> <body> <form> <input type="password" id="password1" value="thgrt456" /> <input type="button" onclick="setFocus()" value="Set focus" /> <input type="button" onclick="loseFocus()" value="Lose focus" /> </form> </body> </html>