关于LEN函数取表单密码长度问题

skying1 2005-12-02 03:44:59
为什么LEN(PWD)取表单密码长度 总是为零。
请高手指点。
...全文
113 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
skying1 2005-12-02
  • 打赏
  • 举报
回复
感谢!!
调试的时候没有注意那个地方,以为没有关系。
原来给它赋值了。
starytx 2005-12-02
  • 打赏
  • 举报
回复
if(document.login.pwd.value="")少个=
skying1 2005-12-02
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆窗口</title>
<script language="JavaScript">
<!--
function check()
{
if (document.login.username.value=="")
{
alert("请输入用户名:");
document.login.username.focus();
return false;
}
if(document.login.pwd.value="")
{
alert("请输入密码:");
document.login.pwd.focus();
return false;
}
}
//-->
</script>
</head>

<body>
<form action="login.asp" method="post" name="login" id="login" onSubmit="return check()">
<table border="0" align="center" cellspacing="10">
<tr>
<td>登陆名:</td>
<td><input name="username" type="text" id="username" maxlength="10"></td>
</tr>
<tr>
<td>密码:</td>
<td><input name="pwd" type="password" id="pwd" maxlength="10"></td>
</tr>
<tr>
<td> </td>
<td align="right"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>
以上为HTML
下面ASP
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆验证</title>
</head>
<%
dim username,pwd
retn_Cndn=true
username=request.Form("username")
username=replace(trim(username),"'","''")
pwd=request.Form("pwd")
pwd=replace(trim(pwd),"'","''")
if (false) then
%>
<script language="JavaScript">
<!--
alert("输入的密码或用户名太短");
location="login.htm";
//-->
</script>
<%
else
response.Write("<p align=center>" & username & "您已成功登陆了</p>")
response.Write(len(username) & len(pwd))
end if
%>
<table width="218" border="0" align="center" cellspacing="0">
<tr>
<td align="center">我的信息</td>
</tr>
<tr>
<td align="center">搜索产品</td>
</tr>
<tr>
<td align="center">聊天室</td>
</tr>
</table>
<%
'end if
%>
<body>
</body>
</html>
skying1 2005-12-02
  • 打赏
  • 举报
回复
PWD我是输入了字符的,为什么USERNAME可以而PWD就是不行。
找了很久都没找到问题。
skying1 2005-12-02
  • 打赏
  • 举报
回复
上面多写了个1 应该是pwd=replace(trim(pwd),"'","''")
starytx 2005-12-02
  • 打赏
  • 举报
回复
PWD是空的
skying1 2005-12-02
  • 打赏
  • 举报
回复
<tr>
<td>密码:</td>
<td><input name="pwd1" type="password" id="pwd" maxlength="10"></td>
</tr>


<%
dim username,pwd
retn_Cndn=true
username=request.Form("username")
username=replace(trim(username),"'","''")
pwd=request.Form("pwd1")
pwd=replace(trim(pwd1),"'","''")
if (false) then
%>

username 能取到, pwd都是零
skying1 2005-12-02
  • 打赏
  • 举报
回复
怎么提??
iChov 2005-12-02
  • 打赏
  • 举报
回复
pwd=trim(request("pwd"))
len(pwd)

没有细节信息,别人没法帮你哦
iChov 2005-12-02
  • 打赏
  • 举报
回复
提问可不是这样的哦

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧