<html>
<body>
密码:<input type="password" id="myPsw" value="psw123456">
<p>单击该按钮可显示密码字段的默认值。</p>
<button type="button" onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myPsw").defaultValue;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>