参考http://www.w3school.com.cn/jsref/dom_obj_password.asp
属性 描述
accessKey 设置或返回访问密码字段的快捷键。
alt 设置或返回当不支持密码字段时显示的替代文字。
defaultValue 设置或返回密码字段的默认值。
disabled 设置或返回是否应被禁用密码字段。
form 返回对包含此密码字段的表单的引用。
id 设置或返回密码字段的 id。
maxLength 设置或返回密码字段中字符的最大数目。
name 设置或返回密码字段的名称。
readOnly 设置或返回密码字段是否应当是只读的。
size 设置或返回密码字段的长度。
tabIndex 设置或返回密码字段的 tab 键控制次序。
type 返回密码字段的表单元素类型。
value 设置或返回密码字段的 value 属性的值。
className 设置或返回元素的 class 属性。
dir 设置或返回文本的方向。
lang 设置或返回元素的语言代码。
title 设置或返回元素的 title 属性。
对象方法:
blur():从密码字段开始移开焦点;
focus():为密码字段设置焦点;
select():选取密码字段中的文本。
for example:
<html> <head> <script type="text/javascript"> function setFocus() { document.getElementById('password1').focus() } function loseFocus() { document.getElementById('password1').blur() } function selectText() { document.getElementById('password1').select() } </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" /> <input type="button" onclick="selectText()" value="select Text" /> </form> </body> </html>