登录(指定登录号密码的简单判断):

jsp数据库增删改查——简单的图书管理系统网页版

 1 <%@ page language="java" import="java.sql.*" pageEncoding="gb2312"%>
 2 <html>
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 5 <title>登录</title>
 6 </head>
 7 <script type="text/javascript">
 8 function check()// JavaScript Document
 9 {
10     var flag = true;
11     if (document.form.no.value == "") {
12         alert("用户名或密码不能为空");
13         form.no.focus();
14         flag = false; 
15     } else if (document.form.psw.value == "") {
16         alert("用户名或密码不能为空");
17         form.psw.focus();
18         flag = false;
19     }
20     if (flag) {
21         document.form.submit();
22     }
23 }
24 </script>
25 <style type="text/css">
26 body {
27     background-repeat: no-repeat;
28     background-attachment: fixed;
29     background-position: center;
30     text-align: center;
31     margin: 0px auto;
32 }
33 
34 div {
35     left: 80%;
36     margin-left: -530px;
37     position: absolute;
38 }
39 </style>
40 <body background="images\1.jpeg">
41     <br>
42     <br>
43     <br>
44     <br>
45     <br>
46     <br>
47     <br>
48     <br>
49     <br>
50     <br>
51     <br>
52     <br>
53     <div>
54         <font face="华文新魏">登录图书管理系统</font>
55         <p>
56         <form name="form" method="post" action="judge.jsp" align="center">
57             <table width="256" border="1">
58                 <tr>
59                     <td width="68" height="43"><font color="#003399">登录号:</font></td>
60                     <td><input type="text" name="no"></td>
61                 </tr>
62                 <tr>
63                     <td height="43"><font color="#003399">密码:</font></td>
64                     <td><input type="password" name="psw"></td>
65                 </tr>
66             </table>
67             <br /> <input type="button" value="登录" onClick="check()"
68                 style="width: 130px;" />
69         </form>
70     </div>
71 </body>
72 </html>
login.jsp

相关文章: