注册表单验证脚本
<script src="/assets/skins/js/jquery-1.11.2.min.js"></script>
<script src="/scripts/jquery/jquery.form.min.js" type="text/javascript"></script>
<script src="/scripts/jquery/Validform_v5.3.2_min.js" type="text/javascript"></script>
<script src="/scripts/jquery/Validform_Datatype.js" type="text/javascript"></script>
<script>
$('#reg-form').Validform({
tiptype: function (msg, o, cssctl) {
if (o.obj.parents("li").find(".infotip").length == 0) {
o.obj.parents("li").append("<div class='infotip' />");
o.obj.parents("li").next().find(".infotip").remove();
}
var objtip = o.obj.parents("li").find(".infotip");
cssctl(objtip, o.type);
objtip.text(msg);
//if (o.type == 3) {
// o.obj.focus();
// $("#tipsText").html(msg);
//}
},
callback: function (form) {
$(form).ajaxSubmit({
url: "/Handle/Reg.ashx?action=reg",
type: "post",
dataType: "json",
beforeSubmit: function (formData, jqForm, options) {
$("#tipsText").html("");
$('#regist_submit_btn').val('正在注册...').attr('disabled', !0);
},
success: function (data, textStatus) {
if (data.status == "failure") {
$("#check_code_tips").html(data.msg);
//$("#checkCode").attr("src", "/tools/verify_code.ashx?" + Math.random());
window.setTimeout(function () {
$('#regist_submit_btn').val('注册').attr('disabled', !1);
}, 1000);
} else if (data.status == "success") {
$('#regist_submit_btn').val('注册成功,页面正在跳转中...');
window.setTimeout(function () {
window.location.href = "/UserCenter";
}, 1000);
} else {
$('#regist_submit_btn').val('注册').attr('disabled', !1);
//$("#checkCode").attr("src", "/tools/verify_code.ashx?" + Math.random());
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#tipsText").html(textStatus + ":" + errorThrown);
}
});
return false;
}
});
</script>