HTML DOM defaultValue 屬性
定義和用法
defaultValue 屬性可設(shè)置或返回密碼域的默認(rèn)值。
注釋:該默認(rèn)值是在 HTML "value" 屬性中規(guī)定的默認(rèn)值。
語(yǔ)法
passwordObject.defaultValue=somevalue
實(shí)例
下面的例子可獲得密碼域的默認(rèn)值:
<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("password1").defaultValue
)
}
</script>
</head>
<body>
<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" id="button1" onclick="alertValue()"
value="Show default value" />
</form>
</body>
</html>