用户输入的密码和确认密码必须一致
2015-06-10 12:02
232 查看
//输入密码,并判断密码是否一致
function funpsd(){
var psd=document.form1.psd.value
if(psd==""){
document.getElementById("sp1").innerHTML="密码不能为空";
}
else if(psd.length<6 || psd.length>15){
document.getElementById("sp1").innerHTML="密码不能小于6位或不能大于15位";
}
else if(isNaN(psd)){
document.getElementById("sp1").innerHTML="密码必须是数字";
}
else {
document.getElementById("sp1").innerHTML="";
}
}
function funcpsd(){
var psd1=document.form1.psd.value;
var psd2=document.form1.cpsd.value; //变量赋值在前
if(psd1!=psd2){
document.getElementById("sp2").innerHTML="密码不一致,请重新输入";
document.form1.psd.select();
//psd2="" //把变量清空,但document.form1.cpsd.value还是原来的值,并没有清空document.form1.cpsd.value的值
document.form1.cpsd.value="";
}
else{
document.getElementById("sp2").innerHTML="";
}
}
function funpsd(){
var psd=document.form1.psd.value
if(psd==""){
document.getElementById("sp1").innerHTML="密码不能为空";
}
else if(psd.length<6 || psd.length>15){
document.getElementById("sp1").innerHTML="密码不能小于6位或不能大于15位";
}
else if(isNaN(psd)){
document.getElementById("sp1").innerHTML="密码必须是数字";
}
else {
document.getElementById("sp1").innerHTML="";
}
}
function funcpsd(){
var psd1=document.form1.psd.value;
var psd2=document.form1.cpsd.value; //变量赋值在前
if(psd1!=psd2){
document.getElementById("sp2").innerHTML="密码不一致,请重新输入";
document.form1.psd.select();
//psd2="" //把变量清空,但document.form1.cpsd.value还是原来的值,并没有清空document.form1.cpsd.value的值
document.form1.cpsd.value="";
}
else{
document.getElementById("sp2").innerHTML="";
}
}
相关文章推荐
- 201506100913_《JavaScript权威指南》(p152-155)
- 什么是激光光源
- androidstudio配置jvm内存大小
- JavaScript中getUTCMinutes()方法的使用详解
- Android Canvas的save(),saveLayer()和restore()浅谈
- HDU-1047-Integer Inquiry(Java大数水题 && 格式恶心)
- 关于PHP.INI中的错误ERROR报告级别设置
- 【坑】如何从iframe中跳出来,让整个页面都跳转
- 用户输入用户名时只能够输入英文、数字和下划线
- HDU 5265
- HDU 5264
- openwrt 3g模块上网
- 平衡二叉树和应用场景
- android上传图片、视频、文件,服务端使用wcf接收
- 判断第几页的公式
- android 保持session
- 光源的寿命到底有多长
- iOS 拨打电话
- (转)Android Superuser提权漏洞分析
- There are no resources that can be added or removed from the server