Password size 屬性

定義和用法
size 屬性可設置或者返回密碼域的的寬度(數字字元)。
默認值為 20。
語法
設置 size 屬性:
passwordObject.size=integer
返回 size 屬性:
passwordObject.size
流覽器支持
所有主要流覽器都支持 size 屬性
實例
實例
設置密碼域的寬度:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<script>
function setResult(){
document.getElementById("pwd").size=40;
}
</script>
</head>
<body>
<form>
密碼: <input type="password" id="pwd">
</form>
<button type="button" onclick="setResult()">設置寬度</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<script>
function setResult(){
document.getElementById("pwd").size=40;
}
</script>
</head>
<body>
<form>
密碼: <input type="password" id="pwd">
</form>
<button type="button" onclick="setResult()">設置寬度</button>
</body>
</html>
