Password size属性

Password オブジェクト

定義と用法

size 属性は、パスワードフィールドの幅(文字数)を設定または返します。

デフォルト値は20です。

语法

size属性を設定する:

passwordObject.size=integer

size属性を返す:

passwordObject.size


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザは size 属性をサポートしています。


实例

实例

パスワードフィールドの幅を設定する:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.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>

尝试一下 »


Password オブジェクト 其他扩展