前端代码:
<!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="../static/css/首页.css"> <script src="../static/js/vue.js"></script> <script src="../static/js/jquery.js"></script> <script th:src="@{js/vue.js}"></script> <script th:src="@{js/jquery.js}"></script> <link rel="stylesheet" th:href="@{css/首页.css}"> <script type="text/javascript"> function getVerify() { $("#verify_input").val(""); $("#imgVerify").attr("src", 'login/getVerify?' + Math.random());//jquery方式 } $(function(){ $("[name=username]").blur(function(){ var username =$("[name=username]").val(); var reg =/^1[3|4|5|7|8][0-9]{9}$/; $.post("selectbyname.do",{"username":username},function(result){ if(result=="1"){ $("#msg").html("该学生(教员)已注册"); $("#msg").css("color","red"); }else if(! reg.test(username)){ $("#msg").html("账号格式不对"); $("#msg").css("color","red"); } else{ $("#msg").html("√"); $("#msg").css("color","green"); } }); }); $("[name=password]").blur(function(){ var password = $("[name=password]").val(); var re