用javascript判断提交的字符少于限制数就抱错,用if判断这个条件
<script type="text/javascript">
function checkPass(){
if (document.form1.pwd.value.length<6)
{alert("密码小于6位");return false;}
}
</script>
</head>
<body>
<form name="form1" action="" method="post">
<input type="text" name="pwd" />
<input type="submit" name="btnOk" value="提交" onclick="return checkPass();">
</form>
</body>
</html>