| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1122 人关注过本帖
标题:请问如何注册时密码不少于六位
只看楼主 加入收藏
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
结帖率:100%
收藏
 问题点数:0 回复次数:3 
请问如何注册时密码不少于六位

我对javascript不熟,不会写,请求帮助
<script language="JavaScript">
//-->
function VerifyInput()
{
username = document.myform.username.value;
if (username == "")
{
alert("请填写您的用户名");
document.myform.username.focus();
return false;
}

password1 = document.myform.password1.value;
if (password1 == "")
{
alert("请填写您的密码");
document.myform.password1.focus();
return false;
}

password2 = document.myform.password2.value;
if (password2 == "")
{
alert("请填写您的确认密码");
document.myform.password2.focus();
return false;
}



if (password2 == password1)
{
}
else
{
alert("您两次输入的密码不相同");
document.myform.password2.focus();
return false;
}

truename = document.myform.truename.value;
if (truename == "")
{
alert("请填写您的真实姓名");
document.myform.truename.focus();
return false;
}

infonumber = document.myform.infonumber.value;
if (infonumber == "")
{
alert("请填写您的身份证号");
document.myform.infonumber.focus();
return false;
}

school = document.myform.school.value;
if (school == "")
{
alert("请填写您的毕业学院");
document.myform.school.focus();
return false;
}


email = document.myform.email.value;
if (email == "")
{
alert("请填写您的电子邮件(Email)");
document.myform.email.focus();
return false;
}

if(document.myform.email.value.length!=0)
{
if (document.myform.email.value.charAt(0)=="." || document.myform.email.value.charAt(0)=="@"|| document.myform.email.value.indexOf('@', 0) == -1 || document.myform.email.value.indexOf('.', 0) == -1||document.myform.email.value.lastIndexOf("@") ==document.myform.email.value.length-1 || document.myform.email.value.lastIndexOf(".")==document.myform.email.value.length-1)
{
alert("您输入的电子邮件(Email)格式不对");
document.myform.email.focus();
return false;
}
}
else
{
alert("Email的不能为空!");
document.myform.email.focus();
return false;
}

tel = document.myform.tel.value;
if (tel == "")
{
alert("请填写您的联系电话");
document.myform.tel.focus();
return false;
}

address = document.myform.address.value;
if (address == "")
{
alert("请填写您的通信地址");
document.myform.address.focus();
return false;
}

postcode = document.myform.postcode.value;
if (postcode == "")
{
alert("请填写您的通信地址");
document.myform.postcode.focus();
return false;
}
}
//-->
</script>

搜索更多相关主题的帖子: 密码 document username myform 
2007-05-18 10:21
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

password1 = document.myform.password1.value;
if (password1.length<6)
{
alert("密码长度不能少于6位");
document.myform.password1.focus();
return false;
}

password2 = document.myform.password2.value;
if (password2 == "")
{
alert("请填写您的确认密码");
document.myform.password2.focus();
return false;
}


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-18 10:24
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
收藏
得分:0 

还有请问为什么以下的密码验证会出错,有时会跳过密码验证为六位,少于六位也不行,请问如何修改呢?
<%
dim username,password1,password2,email,tel,address,postcode
if trim(request("username"))="" then
errmsg=errmsg+"<br>"+"<li>用户名不能为空"
founderr=true
else
username=trim(request("username"))
end if

if trim(request("password1"))="" or trim(request("password2"))="" then
errmsg=errmsg+"<br>"+"<li>密码或确认不能为空"
founderr=true
else
password1=trim(request("password1"))
password2=trim(request("password2"))
end if

if password1 <> password2 then
errmsg=errmsg+"<br>"+"<li>两次密码不同"
founder=true
end if

if len(password1)<6 then
errmsg=errmsg+"<br>"+"<li>密码太简单不得少于六位"
founder=true
end if

if request("truename")="" then
errmsg=errmsg+"<br>"+"<li>真实姓名不能为空"
founderr=true
else
truename=request("truename")
end if
sex=request("sex")

if request("infonumber")="" then
errmsg=errmsg+"<br>"+"<li>身份证号不能为空"
founderr=true
else
infonumber=request("infonumber")
end if


if request("school")="" then
errmsg=errmsg+"<br>"+"<li>毕业学校不能为空"
founderr=true
else
school=request("school")
end if


if isvalidemail(trim(request("email")))=false then
errmsg=errmsg+"<br>"+"<li>你的E-mail有错误"
founderr=true
else
email=trim(request("email"))
end if


if request("tel")="" then
if not IsNumeric(request("tel")) then
errmsg=errmsg+"<br>"+"<li>联系电话不能为空"
founderr=true
end if
else
tel=request("tel")
end if


if request("address")="" then
errmsg=errmsg+"<Br>"+"<li>通信地址不能为空"
founderr=true
else
address=request("address")
end if

if request("postcode")="" then
errmsg=errmsg+"<br>"+"<li>邮编不能为空"
founderr=true
else
postcode=request("postcode")
end if
sex=request("sex")
untime=request("untime")
profe1=request("profe1")
profe2=request("profe2")


set rs=server.createobject("adodb.recordset")
sql="select * from user where username='"&username&"'"
rs.open sql,conn,3,3
if not rs.eof then
errmsg=errmsg+"<br>"+"<li>用户名已被别人注册"
founderr=true
end if
rs.close
set rs=nothing
%>


请高手帮忙解决以上两个问题,在此谢过!


弃我去者昨日之日不可留,乱我心者今日之日多烦忧。
2007-05-18 10:25
lzlcn
Rank: 2
来 自:广东网络公司
等 级:论坛游民
帖 子:100
专家分:10
注 册:2007-5-18
收藏
得分:0 

谢谢阳光白雪,我这就试试


弃我去者昨日之日不可留,乱我心者今日之日多烦忧。
2007-05-18 10:26
快速回复:请问如何注册时密码不少于六位
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020999 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved