$(document).ready(function () { var timer = null; timer = setInterval(function () { $(".zhedang").hide(); }, 400) document.addEventListener('gesturestart', function (e) { e.preventDefault(); }); document.addEventListener('dblclick', function (e) { e.preventDefault(); }); document.addEventListener('touchstart', function (event) { if (event.touches.length > 1) { event.preventDefault(); } }); var lastTouchEnd = 0; document.addEventListener('touchend', function (event) { var now = (new Date()).getTime(); if (now - lastTouchEnd <= 300) { event.preventDefault(); } lastTouchEnd = now; }, false); var timer = null; function publicBox(publicText) { $(".AlertBox").show(); $(".AlertBoxChilds").html(publicText); timer = setInterval(function () { $(".AlertBox").hide(); }, 2000) } function publicBoxBack(publicText) { $(".AlertBox").show(); $(".AlertBoxChilds").html(publicText); timer = setInterval(function () { $(".AlertBox").hide(); window.history.back(); }, 2000) } $(".registerShuomingBackBtn").on("click", function () { window.history.back(); }) $(".LoginBtn").on("click", function () { clearInterval(timer) if ($("#account").val() == "") { publicBox("Please fill in the account number"); } else if ($("#password").val() == "") { publicBox("Please fill in the password"); } else if ($("#repeatpassword").val() == "") { publicBox("Please repeat the password"); } else if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/.test($("#account").val())) { publicBox("Length 8-12 digits + letters"); } else if ($("#password").val() != $("#repeatpassword").val()) { publicBox("The two passwords are inconsistent"); } else if (!/^\d{6}$/.test($("#repeatpassword").val())) { publicBox("Please enter a 6-digit password"); } else if (!/^\d{6}$/.test($("#password").val())) { publicBox("Please enter a 6-digit password"); } else { $.ajax({ type: "post", url: "https://www.bibidd.com/bibidd/user/slUserRegister", dataType: "json", data: { account: $("#account").val(), password: $("#password").val() }, success: function (res) { if (res.code == "200") { publicBoxBack("Registered successfully") } else if (res.code == "201") { publicBox("Registration failed. Please try again"); } else if (res.code == "202") { publicBox("Incorrect parameters"); } else if (res.code == "203") { publicBox("The account has already been registered"); } } }) } }) })