怎么判断密码的长度?或者只要判密码是否为空就行了? 长度strlen($string)是否为空$string != "" 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是输入用户名和密码提交给PHP处理,这时要判密码会不会为空。为空报错呀! 不好意思!!是程序别的地方出错了与strlen() 无关 先trim(),然后判断长度,或者用jscript,直接客户端判断 用js吧if(document.formname.passwordname.length==0){ alert("请您输入密码!"); document.formname.passwordname.focus(); return false;} strlen(trim($password))我靠还不成就是你的作风问题了:) <script language=javascript> function checkLoginForm() { if (document.all.loginform.login_name.value == '') { alert('请输入用户名!'); document.all.loginform.login_name.focus(); return false; } if (document.all.loginform.login_pass.value == '') { alert('请输入密码!'); document.all.loginform.login_pass.focus(); return false; } } </script><table cellspacing=1><tr><td><FORM method="POST" action="" onsubmit="return checkLoginForm();" name=loginform> <table cellspacing="0" width=147> <TR> <TD colspan="2" align="center" class="header">::自助管理入口::</TD> </TR> <TR> <TD align="right">用户名:</TD> <TD><INPUT size="10" type="text" name="login_name"></TD> </TR> <TR> <TD align="right">密 码:</TD> <TD><INPUT size="10" type="password" name="login_pass"></TD> </TR> <TR> <TD colspan="2" align="center"><INPUT type="submit" name="login" value="登录" class=button> <INPUT type="button" name="register" value="注册" onclick="window.open('$website_addr/user/register.php','_blank','strollbar=no,width=300,height=300,left='+(screen.width-300)/2+',top='+(screen.height-400)/2);" class=button></TD> </TR> </table> </FORM></td></tr></table> php操作word的问题 关于web编程问题,求救 请教UCHome中几张表的语义 resin下安装drupal 5.5的时候出现的怪异问题 php实现文件上传的问题,急急急 一个php查询mysql数据库的问题!急!在线等! 请教高手!php的问题 php中关于类的疑问 前几天还好好的,今天就怎么也不认session了!急救 各位大虾帮帮我,到底如何安装php+IIS? 4.12 请各位帮我看下代码,问题出在哪儿
提交给PHP处理,这时要判密码会不会为空。为空报错呀!
与strlen() 无关
{
alert("请您输入密码!");
document.formname.passwordname.focus();
return false;
}
我靠还不成就是你的作风问题了
:)
function checkLoginForm()
{
if (document.all.loginform.login_name.value == '') {
alert('请输入用户名!');
document.all.loginform.login_name.focus();
return false;
}
if (document.all.loginform.login_pass.value == '') {
alert('请输入密码!');
document.all.loginform.login_pass.focus();
return false;
}
}
</script><table cellspacing=1><tr><td>
<FORM method="POST" action="" onsubmit="return checkLoginForm();" name=loginform>
<table cellspacing="0" width=147>
<TR>
<TD colspan="2" align="center" class="header">::自助管理入口::</TD>
</TR>
<TR>
<TD align="right">用户名:</TD>
<TD><INPUT size="10" type="text" name="login_name"></TD>
</TR>
<TR>
<TD align="right">密 码:</TD>
<TD><INPUT size="10" type="password" name="login_pass"></TD>
</TR>
<TR>
<TD colspan="2" align="center"><INPUT type="submit" name="login" value="登录" class=button> <INPUT type="button" name="register" value="注册" onclick="window.open('$website_addr/user/register.php','_blank','strollbar=no,width=300,height=300,left='+(screen.width-300)/2+',top='+(screen.height-400)/2);" class=button></TD>
</TR>
</table>
</FORM></td></tr></table>