仿通行证盛大注册页面
来源:互联网 发布:好听的淘宝文具名称 编辑:程序博客网 时间:2024/06/11 21:24
/*保存为input.js*/--------------------------------------------------------------------------------------------------------------------------------------------------------------------
var mobileTipToOverseas = '<span class="phoneerrortip">请输入11位手机号码</span>';
var mobileTipToChina = '这不是中国大陆手机号码,请联系客服';$(function () {
$("#Mobile").bind("keydown keyup", function (e) {
$("#IdentifyingCode").val('');
if (!$("#btn_getCode").hasClass("smscodesendloop")) {
var em = e.target.value;
if (!/^\s*$/.test(em) && !/\D+/.test(em) && /^0*(13|15|18|14)\d{9}$/.test(em)) {
var PhoneNumber=$("#Mobile").val();
$.get("index.php?user", { q: "action/checkPhoneNumber", PhoneNumber: PhoneNumber},function (result){
if ( result == true ){
$("#MobileTip").find(".tipsInfo").html("可以注册!");
$("#btn_getCode").text('免费获取验证码');
$('#btn_getCode').removeClass("wait");
$('#btn_getCode').addClass("smscodesendloop");
}
else{
$("#MobileTip").find(".tipsInfo").html("手机号码已存在");
}
});
}
else {
$("#MobileTip").find(".tipsInfo").html(mobileTipToOverseas);
$("#btn_getCode").text('免费获取验证码');
$('#btn_getCode').addClass("wait");
}
}
else {
if (!$("#btn_getCode").hasClass("smscodesendloop")) {
$('#btn_getCode').addClass("smscodesendloop");
}else{
var em = e.target.value;
if (!/^\s*$/.test(em) && !/\D+/.test(em) && /^0*(13|15|18|14)\d{9}$/.test(em)) {
}else{
$('#btn_getCode').removeClass("smscodesendloop");
$("#MobileTip").find(".tipsInfo").html(mobileTipToOverseas);
$("#btn_getCode").text('免费获取验证码');
$('#btn_getCode').addClass("wait");
}
}
}
})
//=====================================================================
// 验证框架
//=====================================================================
$.Valid = {
//@param obj Object 验证逻辑 键名为错误提示,键值为验证函数,函数的传参为当前INPUT元素,返回true显示错误提示
//逐个验证表单的每个域
//@param root Element|String 为表单元素或表单的CSS表达式
//@param name String INPUT等元素的name属性,同时要求它拥有一个同名的类名,为了方便显示提示信息,
//@callbacks name Object 回调对象,可以存在error或者success方法
//此元素下拥有一个类名为tips的DIV,里面拥有三种提示
/* <div class="inputBox">
<span class="inputLabel">立即可见的提示信息</span>
<input class="username" name="username" tabindex="10" />
</div>
<div class="tips" id="usernameTip">
<p class="tipsInfo">获得焦点或输入时的提示信息</p>
<p class="tipsError">失去焦点验证失败的错误信息</p>
<p class="tipsSuc">失去焦点验证成功的信息——通常表现为一个绿勾</p>
</div>
*/
check: function (root, name, obj, callbacks) {
$(root).delegate("." + name, "blur", function () {
if ($.Valid.isNeedCheck) {
var ok = true;
for (var msg in obj) {
if (obj[msg](this)) {
$.Valid.handleTip(this, "#" + name + "Tip", 0, msg, callbacks);
ok = false;
break;
}
}
if (ok) {
$.Valid.handleTip(this, "#" + name + "Tip", 1, msg, callbacks);
}
$.Valid.handlePlaceHoder(this, false);
}
}).delegate("." + name, "focus", function () {
//清空所有提示,以便重新验证
$.Valid.handleTip(this, "#" + name + "Tip", 2);
$.Valid.handlePlaceHoder(this, true);
})
},
isNeedCheck: true,
//注意,当我们发出最后提交时,看一下$.Valid.nodes是否为空,不为空说明还有验证没通过
nodes: [],
//处理placehoder的显示隐藏与样式,获得焦点时会变浅
handlePlaceHoder: function (node, focus) {
var placehoder = $(node).parent().children(".inputLabel")
var parent = $(node).parent()
if (typeof (node.value) != "undefined" && node.value.length) {
//如果有文字,则隐藏placehoder
placehoder.addClass("inputLabelHide");
} else {
//如果没有文字,则显示placehoder
placehoder.removeClass("inputLabelHide");
}
if (focus) {
//将提示信息的颜色变浅
parent.addClass("inputFocus");
} else {
//将提示信息的颜色变深
parent.removeClass("inputFocus");
}
},
//用于显示错误提示
//HTML 格式 <div class="l tips"><em id="err-intro"></em></div>
//@param input 需要验证的INPUT元素
//@param id 装载各种提示信息的容器的ID
//@param status
//0 表示显示失败信息,这时第三个参数有效,显示这红色字
//1 表示显示成功信息,会在此元素的父节点上添加一个叫okey的类名,显示绿色的勾号
//2 表示隐藏成功与失败信息,去掉元素的innerHTML与父节点上的okey的类名
//4 表示仅仅显示信息
//@param msg 错误消息
handleTip: function (input, id, status, msg, callbacks) {
var tips = $(id);
var nodes = $.Valid.nodes;
var node = tips[0];
var index = $.inArray(node, nodes);
switch (status) {
case 0:
tips.addClass("show_tips");
tips.find(".tipsError").show().html(msg);
tips.find(".tipsBg").show();
tips.find(".tipsInfo").hide();
//加上红色边框
$(input).parent(".inputBox").addClass("inputError")
$(input).parent(".inputBox").removeClass("inputSuc");
if (index == -1) {//用去统计当前页面有多少个验证没有被通过
nodes.push(node);
}
if (callbacks && callbacks.error) {
callbacks.error()
}
break;
case 1:
tips.removeClass("show_tips");
tips.find(".tipsError").hide();
tips.find(".tipsInfo").hide();
tips.find(".tipsBg").hide();
//移除红色边框
$(input).parent(".inputBox").removeClass("inputError");
$(input).parent(".inputBox").addClass("inputSuc");
if (index >= 0) {
nodes.splice(index, 1);
}
if (callbacks && callbacks.success) {
callbacks.success()
}
break
case 2:
tips.find(".tipsError").hide();
tips.find(".tipsInfo").show();
if (tips.find(".tipsInfo").html() == "" || tips.find(".tipsInfo").html() == null) {
tips.removeClass("show_tips");
tips.find(".tipsBg").hide();
} else {
tips.addClass("show_tips");
tips.find(".tipsBg").show();
}
//移除红色边框
$(input).parent(".inputBox").removeClass("inputError")
$(input).parent(".inputBox").removeClass("inputSuc");
if (index >= 0) {
nodes.splice(index, 1);
}
break
case 3:
//移除红色边框
for (var i = 0; i < nodes.length; i++) {
$(nodes[i]).find("p").hide();
$(nodes[i]).siblings(".inputBox").removeClass("inputError");
$(input).parent(".inputBox").removeClass("inputSuc");
}
nodes.splice(0, nodes.length);
break
case 4:
tips.find(".tipsError").hide();
tips.find(".tipsInfo").show().html(msg);
if (tips.find(".tipsInfo").html() == "" || tips.find(".tipsInfo").html() == null) {
tips.removeClass("show_tips");
tips.find(".tipsBg").hide();
} else {
tips.addClass("show_tips");
tips.find(".tipsBg").show();
}
//移除红色边框
$(input).parent(".inputBox").removeClass("inputError")
$(input).parent(".inputBox").removeClass("inputSuc");
break
}
}
}
validate = $.Valid.check;
//当placehoder被点中,将焦点移到输入框内
$(".inputBox .inputLabel").live("click", function () {
$(this).parent().children("input").focus();
});
//当用户输入时,判定是否隐藏PlaceHoder
$("#form0").delegate("input", "keypress keydown mousedown", function () {
var node = this;
setTimeout(function () {
$.Valid.handlePlaceHoder(node, true)
}, 0)
});
//判定密码强度
$("#form0").delegate(".Password", "keydown keyup mousedown", function (e) {
var length = this.value.length;
if (length <= 6) {
$("#PasswordTip .tipsInfo").removeClass("curLow curMiddle curHigh")
$("#PasswordTip .tipsInfo").addClass("curLow")
} else if (length < 11) {
$("#PasswordTip .tipsInfo").removeClass("curLow curMiddle curHigh")
$("#PasswordTip .tipsInfo").addClass("curMiddle")
} else if (length < 30) {
$("#PasswordTip .tipsInfo").removeClass("curLow curMiddle curHigh")
$("#PasswordTip .tipsInfo").addClass("curHigh")
}
//if(!showPassBtnClick && e.type == "keydown"){
// $(".password_tip:not('.active')").addClass("active").stop(true,true).show().animate({opacity : 1},700);
//}
});
//验证码验证
validate("#form0", "IdentifyingCode", {
"验证码未填写": function (node) {
var ret = /^\s*$/.test(node.value)
return ret
},
"填写错误,验证码为短信中的6位字符": function (node) {
var ret = !/^\d{6}$/.test(node.value)
return ret
}
})
//密码验证
validate("#form0", "Password", {
//没有通过返回true,以显示错误信息
"密码未填写": function (node) {
return /^\s*$/.test(node.value)
},
"密码过短,至少6位字母和数字": function (node) {
return node.value.length < 6
},
"密码过长,最多30位字母或数字": function (node) {
return node.value.length > 30
},
"密码含非法字符,仅能使用字母或数字。<a href='javascript:void(0);' class='showPassBtn' hidefocus='true'>检查密码</a>": function (node) {
if (pageType == 'mini') {
return false;
}
return /[\W_]/.test(node.value); //存在非法字符
},
"密码含非法字符,仅能使用字母或数字。": function (node) {
if (pageType != 'mini') {
return false;
}
return /[\W_]/.test(node.value); //存在非法字符
},
"密码不能为手机号码": function (node) {
return $("#form0 .Mobile").val() === node.value;
},
"密码过于简单,不能为同一字符": function (node) {
var s = node.value;
var errorLength = 0;
var tmpLength = 1;
var i = 0;
for (i = 1; i < s.length; i++) {
if (s.substr(i, 1) == s.substr(i - 1, 1)) {
tmpLength++;
}
else {
tmpLength = 1;
}
if (tmpLength > errorLength) {
errorLength = tmpLength;
}
}
return errorLength === s.length;
},
"密码过于简单,不能为连续字母": function (node) {
var s = node.value;
var lvLastChar = s.substring(0, 1);
var lvLetterDiff = 0;
if (isNaN(lvLastChar)) {
for (var i = 1; i < s.length; i++) {
var c = s.substring(i, i + 1);
if (isNaN(c)) {
if (i == 1) {
lvLetterDiff = convertCharLetterInt(c) - convertCharLetterInt(lvLastChar);
if (lvLetterDiff != 0 && lvLetterDiff != 1 && lvLetterDiff != -1) {
return false;
}
}
else {
if ((convertCharLetterInt(c) - convertCharLetterInt(lvLastChar)) != lvLetterDiff) {
return false;
}
}
lvLastChar = c;
}
else {
return false;
}
}
return true;
}
else {
return false;
}
},
"密码过于简单,不能为连续数字": function (node) {
var s = node.value;
var lvLastChar = s.substring(0, 1);
var lvLetterDiff = 0;
for (var i = 1; i < s.length; i++) {
var c = s.substring(i, i + 1);
if (isNaN(c) == false) {
if (i == 1) {
lvDigitialDiff = parseInt(c) - parseInt(lvLastChar);
if (lvDigitialDiff != 0 && lvDigitialDiff != 1 && lvDigitialDiff != -1) {
return false;
}
}
else {
if ((parseInt(c) - parseInt(lvLastChar)) != lvDigitialDiff) {
return false;
}
}
lvLastChar = c;
}
else {
return false;
}
}
return true;
}
});
//手机号码验证
validate("#form0", "Mobile", {
"手机号码未填写": function (node) {
return /^\s*$/.test(node.value)
},
"手机号码只能为数字": function (node) {
return /\D+/.test(node.value)
},
"手机号码填写不正确": function (node) {
return !/^0*(13|15|18|14)\d{9}$/.test(node.value);
},
"手机号码填写不正确": function (node) {
if (pageType != 'mini') {
return false;
}
return !/^0*(13|15|18|14)\d{9}$/.test(node.value);
}
}, {
success: function () {
}
});
/*显示密码*/
var showPassBtnClick = false;
$("#form0").delegate(".showPassBtn", "click", function () {
var $input = $("#Password");
var html = ["<input type="]
if ($input.attr("type") === "password") {
$("#btnShowPass").text("隐藏密码");
$(".password_tip").stop(true, true).animate({ opacity: 0 }, 700, function () { $(this).removeClass("active").hide() });
html.push("text")
} else {
$("#btnShowPass").text("显示密码");
$(".password_tip:not('.active')").addClass("active").stop(true, true).show().animate({ opacity: 1 }, 700);
html.push("password")
}
String("tabindex,value,class,name,id").replace(/[^, ]+/g, function (p) {
var val = $input.attr(p);
if (val) {
html.push(" " + p + "='" + val + "'");
}
});
html.push(" />")
$input.replaceWith(html.join(""));
$(".Password").focus().val($(".Password").val());
});
})
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
保存为页面
<script language="javascript" type="text/javascript">
var maxTime = 120;
var currInterval;
$(function () {
isSendSMSCode = false;
$("#btn_getCode").click(function () {
var node = $("#btn_getCode");
var PhoneNumber= $("#Mobile").val();
var SendType= $("#send_type").val();
if(!node.hasClass("wait")){
if (!isSendSMSCode) {
$.post("index.php?user", { q: "action/send_sms", phone: PhoneNumber,sendtype:SendType},function (data) {
if (data.Status == "01" || data.Status == "03") {
isSendSMSCode = true;
// node.addClass("smscodesendloop");
currInterval = setInterval(CheckTime, 1000);
$("#IdentifyingCodeTip").find(".tipsInfo").html("发送成功,请注意接收短信。");
} else {
alert(data.msg);
$("#IdentifyingCodeTip").find(".tipsInfo").html("发送失败,稍后重试!");
}
}, 'json');
} else {
$("#IdentifyingCodeTip").find(".tipsInfo").html("已经发送,请注意查收短信。");
}
}
});
});
function CheckTime() {
if (maxTime == 1) {
isSendSMSCode = false;
$("#btn_getCode").text('免费获取验证码');
$('#btn_getCode').removeClass("wait");
maxTime = 120;
if (currInterval) {
clearInterval(currInterval);
}
} else {
maxTime = maxTime - 1;
$("#btn_getCode").text("" + maxTime.toString() + " 秒后再次获取");
}
}
//检验手机注册
function SmsReg(){
if (IsNuLLOrEmpty($("#Mobile").val()) || IsNuLLOrEmpty($("#IdentifyingCode").val()) || IsNuLLOrEmpty($("#Password").val())){
return false;
}else{
return true;}
}
function IsNuLLOrEmpty(str){
if(str =="" || str==null || str=="undefined"){
return true;
}else{
return false;
}
}
</script>
<div class="registPhone">
<form action="" method="post" name="formUser" id="form0" onsubmit="return SmsReg();" class="form_horizontal">
<input name="invite_userid" type="hidden" value="{$magic.session.reginvite_user_id}" />
<input name="type_id" type="hidden" value="2" />
<input name="send_type" type="hidden" id="send_type" value="1" />
<div id="input_wrap_username" class="input_wrap">
<div class="inputBox ">
<span class="inputLabel">手机号码(必须填写)</span>
<input type="text" autocomplete="off" tabindex="10" maxlength="11" name="phone" id="Mobile" class="text Mobile">
</div>
<div id="MobileTip" class="tips">
<p class="tipsInfo" ><span class="phoneerrortip">请输入11位手机号码</span></p>
<p class="tipsError">手机号码未填写</p>
<p class="tipsBg" ></p>
</div>
</div>
<div id="input_wrap_smscode" class="input_wrap">
<div class="inputBox input_with_btn ">
<span class="inputLabel">短信验证码(必须填写)</span>
<input type="text" tabindex="11" id="IdentifyingCode" name="IdentifyingCode" maxlength="6" class="text IdentifyingCode" autocomplete="off">
<a hidefocus="true" class="input_expand_btn wait" id="btn_getCode" href="javascript:void(0);">免费获取验证码</a>
</div>
<div id="IdentifyingCodeTip" class="tips">
<p class="tipsInfo" >请填写短信中的6位数字,收不到请重试</p>
<p class="tipsError">填写错误,验证码为短信中的6位数字</p>
<p class="tipsBg"></p>
</div>
</div>
<div id="input_wrap_password" class="input_wrap">
<div class="inputBox ">
<span class="inputLabel">静态密码(必须填写)</span>
<input type="Password" tabindex="13" id="Password" maxlength="30" name="password" class="text Password" autocomplete="off">
</div>
<div id="PasswordTip" class="tips">
<p class="tipsInfo curLow">
<span>6~30位字母或数字,<a hidefocus="true" class="showPassBtn" name="btnShowPass" id="btnShowPass" href="javascript:void(0);">显示密码</a>
</span>
<span class="rankLow">弱</span>
<span class="rankMiddle">中</span>
<span class="rankHigh">强</span>
</p>
<p class="tipsError" >密码未填写</p>
<p class="tipsBg" ></p>
</div>
</div>
<table>
<tr>
<td valign="middle" style="color:#888;">
<input type="checkbox" id="agreebox" onchange="return changeBox();" >
我已阅读并同意<<<a href="#" >壹信用服务协议</a>(个人会员版)>>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle">
<div class="yinsinew" style="color:#888;">
<b>*</b> 我们重视您的隐私,您所填写的信息仅为了您在本站的方便
使用,我们不会泄露您的任何信息给任何第三方。 </div> </td>
</tr>
<tr>
<td colspan="2" align="center" valign="middle"><br />
<input name="Submit" type="submit" value="" width="170" disabled="disabled" height="29" id="submit" class="reg_button" style="cursor: pointer" align="absmiddle"/>
</td>
</tr>
</table>
</form>
</div>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
css
/* 手机注册 by dustin*/
.registPhone{
width: 400px; height: 420px;padding-top:50px;margin:0 auto;
}
.input_expand_btn, .submit_btn, .btn, .btn span, .mod_regist_border1, .mod_regist_border2, .country_search .search_btn, .mod_success .bind_mobile_prev .inputBox, .popup a.submit_btn, .popup a.submit_btn_2, .popup a.submit_btn_regInfo, .popup a.close_btn_regInfo, .popup a.submit_btn_Promoter, .popup a.close_btn_Promoter, #popup_Contrast .row_last a, #popup_Contrast .row_last a span, .inputBox, #popup_Info .input_right_bg {
background-image: url("/themes/ruizhict/images_pub/sprite_btn.png");
background-repeat: no-repeat;
}
.tipsError, .tipsInfo, .mod_success h3, .mod_success .blockquoteTop, .mod_success .blockquoteBottom, .mod_success .noticeTips span.icon, .flag, .verifyCode .reVerify, .cell_slider a.prev, .cell_slider a.next, .pop_main_suc .setLA_check, .mod_success .bind_mobile_suc .icon, .mod_success .bind_mobile_prev .close_tips, #popup_Info p.suc_tips, #popup_Promoter p.suc_tips, .close_popup, #popup_Contrast .support, .mod_regist_nav .icon, .mod_regist_nav .arrow {
background-image: url("/themes/ruizhict/images_pub/sprite_icon.png");
background-repeat: no-repeat;
}
.registPhone #input_wrap_username {
display: block;
z-index: 790;
}
.registPhone #input_wrap_smscode {
display: block;
}
#input_wrap_password.input_wrap {
display: block;
}
.input_wrap {
display: none;
position: relative;
z-index: 760;
}
.registPhone #input_wrap_username .inputBox {
z-index: 770;
}
.inputError {
}
.inputBox {
background-position: -2px -440px;
height: 40px;
position: relative;
top: 4px;
width: 350px;
z-index: 10;
}
.inputBox .inputLabel {
color: #999999;
cursor: text;
display: block;
font-size: 14px;
left: 14px;
line-height: 16px;
position: absolute;
top: 14px;
vertical-align: middle;
z-index: 9;
}
.inputBox .inputLabel.inputLabelHide {
display: none;
}
.inputBox input {
background-color: rgba(0, 0, 0, 0);
border: medium none;
color: #222222;
display: inline;
float: left;
font: 700 16px/23px Arial;
height: 23px;
padding: 9px 12px 8px;
position: absolute;
vertical-align: middle;
width: 326px;
z-index: 10;
}
/*/提示框*/
.registPhone #input_wrap_username .tips {
z-index: 8;
}
.registPhone #input_wrap_username {
display: block;
z-index: 790;
}
.registPhone #input_wrap_smscode {
display: block;
}
#input_wrap_password.input_wrap {
display: block;
}
.show_tips {
visibility: visible;
}
.tips {
height: 25px;
line-height: 20px;
margin-bottom:5px;
overflow: hidden;
position: relative;
top: -60px;
visibility: hidden;
width: 350px;
z-index: 8;
}
.tipsInfo, .tipsSuc, .tipsError, .tipsBg {
background-color: #FEFFEE;
border: 1px solid #E3DEB4;
color: #676762;
display: none;
font-size: 12px;
height: 23px;
line-height: 23px;
overflow: hidden;
padding-left: 35px;
width: 312px;
}
.tipsInfo {
background-color: #FEFEFE;
background-position: 12px -414px;
}
.tipsError {
background-color: #FEFEFE;
background-position: 12px -433px;
}
.tipsBg {
display: none;
overflow: hidden;
}
.input_with_btn a.input_expand_btn.wait {
background-position: -292px -3px;
color: #666666;
height: 40px;
line-height: 40px;
overflow: hidden;
}
.input_with_btn a.input_expand_btn {
background-position: -4px 0;
color: #FFFFFF;
display: block;
height: 38px;
line-height: 38px;
position: absolute;
right: 1px;
text-align: center;
text-decoration: none;
top: 1px;
width: 142px;
z-index: 11;
}
.show_tips {
visibility: visible;
}
.tips .rankLow, .tips .rankMiddle, .tips .rankHigh {
background: none repeat scroll 0 0 #CEF0F5;
color: #FEFDFE;
cursor: default;
display: block;
height: 18px;
line-height: 18px;
margin: 3px 1px 1px;
text-align: center;
width: 45px;
}
.tips span {
float: left;
}
.tips .curLow .rankLow, .tips .curMiddle .rankMiddle, .tips .curHigh .rankHigh {
background: none repeat scroll 0 0 #58CBFD;
color: #FFFFFF;
}
.tips .rankLow {
margin-left: 5px;
}
#PasswordTip span .showPassBtn {
margin-right: 15px;
}
.tips a:link {
color: #4A9CE6;
text-decoration: none;
}
.yinsinew{width:400px;}
- 仿通行证盛大注册页面
- 仿百度注册页面
- 仿支付宝注册页面效果
- 通行证
- 蜗牛—JavaScript学习之仿网易邮箱注册页面
- 儿童业态放公司梵蒂冈仿盛大
- 盛大
- 盛大
- js实现密码强度验证(显示强度,仿CSDN注册页面的密码验证)
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- 注册页面
- windows(xp)下git服务器搭建
- XML-解析技术续(dom4j解析)
- 百度地图应用开发遇到的问题
- 流畅显示滚动图片
- WebSphere 的IHS 启动没日志,但无法访问
- 仿通行证盛大注册页面
- DLL的进入退出——由DLL_PROCESS_ATTACH而联系搜索起来
- 线性表描述
- scheam中的<anyAttribute>元素
- iOS Runtime 学习笔记
- Javascript & AJAX
- [LeetCode] Binary Tree Level Order Traversal
- jquery表格分组插件-jquery.tablegroup.js
- uva 571 - Jugs