name 属性可设置或返回密码域的名称。
passwordObject.name=name
下面的例子可获得密码域的名称:
<html>
<body>
<form id="form1">
<input type="password" id="password1" name="password1" />
</form>
<p>The name of the password field is:
<script type="text/javascript">
x=document.getElementById('password1');
document.write(x.name
);
</script></p>
</body>
</html>