<!DOCTYPE html>
<html>
<body>
密码:<input type="password" id="myPsw">
<p>单击该按钮可更改密码字段的宽度。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
document.getElementById("myPsw").size = "50";
}
</script>
</body>
</html>