js前台的。
<input name="password" id="password" type="password" value="" size="38" class="input">
<script language="JavaScript" type="text/javascript">
str=getElementById('password').value
if(str.length<6){
return false;
alert('对不起,您的密码小于六位');
}
</script>
在你的form标签里要写上onsubmit调用这个函数才行。
---------------------------------------------------
php后台的。
<?php
$str=$_POST['password'];
if(strlen($str)<6){
echo '对不起,您的密码小于六位';
}
?>
温馨提示:答案为网友推荐,仅供参考