123456789101112131415161718192021<!DOCTYPE html>charset="utf-8"W3Cschool教程(w3cschool.cn)function displayResult(){var x=document.getElementById("pwd").maxLength;alert(x);}密码: type="password" id="pwd" maxlength="8"type="button" onclick="displayResult()"显示允许输入的最多字符数