1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| <%-- Created by IntelliJ IDEA. User: Yiqing Date: 2020-11-16 Time: 10:47 a.m. To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> <script src="${pageContext.request.contextPath}/statics/js/jquery-3.5.1.js"></script>
<script> function a1() { $.post({ url:"${pageContext.request.contextPath}/a3", data: {"name":$("#name").val()}, success:function(data){ if(data.toString() === 'ok'){ $("#userInfo").css("color","green"); }else{ $("#userInfo").css("color","red"); } $("#userInfo").html(data) } }) } function a2() { $.post({ url:"${pageContext.request.contextPath}/a3", data: {"pwd":$("#pwd").val()}, success:function(data){ if(data.toString() === 'ok'){ $("#pwdInfo").css("color","green"); }else{ $("#pwdInfo").css("color","red"); } $("#pwdInfo").html(data) } }) } </script> </head> <body>
<p> 用户名: <input type="text" id="name" onblur="a1()"> <span id="userInfo"></span> </p> <p> 密码: <input type="text" id="pwd" onblur="a2()"> <span id="pwdInfo"></span> </p>
</body> </html>
|