首页 > 代码库 > tipsText表单验证(注册)
tipsText表单验证(注册)
注册表单验证脚本
<script src="http://www.mamicode.com/assets/skins/js/jquery-1.11.2.min.js"></script>
<script src="http://www.mamicode.com/scripts/jquery/jquery.form.min.js" type="text/javascript"></script>
<script src="http://www.mamicode.com/scripts/jquery/Validform_v5.3.2_min.js" type="text/javascript"></script>
<script src="http://www.mamicode.com/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>
tipsText表单验证(注册)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。