自强学堂
自强学堂:学习、分享、让你更强!
JavaScript 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

HTML DOM Password type 属性

Password 对象参考手册 Password 对象

定义和用法

type 属性可返回表单元素的类型。

对于密码域,该属性总是 "password"。

语法

passwordObject.type


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 type 属性


实例

实例

下面的例子返回了该密码域的表单元素类型:

<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("pwd").type;
alert(x);
}
</script>
</head>
<body>

<form>
Password: <input type="password" id="pwd">
</form>

<button type="button" onclick="displayResult()">Display input type</button>

</body>
</html>

尝试一下 »


Password 对象参考手册 Password 对象