zoukankan      html  css  js  c++  java
  • 2020.11.10收获

    index.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>人口普查系统</title>
        <style type="text/css"> 
               a{font-size:30px}
        </style>
    </head>
    <body><% 
    Object message =request.getAttribute("message");
    if(message!=null&&!"".equals(message)){
    %>
        <script type="text/javascript">
        alert("<%=request.getAttribute("message")%>");
        </script>
    <%}%>
    
    
    
        <div align="center" font-size="30px">
            <h1>人口普查系统</h1>
            <div>
                <a  href="insert.jsp">信息登记</a>
            </div>
            <div>
                <a href="servlet?method=list">信息修改</a>
            </div>
            <div>
                <a href="servlet?method=list">信息删除</a>
            </div>
            <div>
                <a href="servlet?method=list">浏览信息</a>
            </div>
            <div>
                <a href="servlet?method=list">查询信息</a>
            </div>
    
    
        </div>
    </body>
    </html>

    insert.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>添加</title>
    </head>
    <body>
        <%
            Object message = request.getAttribute("message");
            if (message != null && !"".equals(message)) {
        %>
        <script type="text/javascript">
                  alert("<%=request.getAttribute("message")%>"); //弹出对话框
        </script>
        <%
            }
        %>
        <div align="center">
            <h1>添加信息</h1>
            <a href="index.jsp">返回主页</a>
           
      <form action="servlet?method=insert" method="post">
          <table id="addTable" class="table table-bordered  ">
           <tr class="text-center row">
                   <tr> 
                      <td class="col-sm-2">
                        id
                      </td>
                      <td class="col-sm-4">
                       <input type="text" class="form-control"  name="id" id="id" >
                      </td>
                  <tr class="text-center row">
                    <td class="col-sm-2">
                      户别
                    </td>
                    <td class="col-sm-4">
                      <input type="radio"  name="hubie" id="hubie" value="家庭户">家庭户
                      <input type="radio"  name="hubie" id="hubie" value="集体户">集体户
                    </td></tr>
                    <tr>
                    <td class="col-sm-2">
                      住房类型
                    </td>
                    <td class="col-sm-4">
                              <input type="radio"  name="livetype" id="livetype" value="家庭住宅">家庭住宅
                              <input type="radio"  name="livetype" id="livetype" value="集体住所">集体住所
                            </td><tr><td> </td><td> 
                              <input type="radio"  name="livetype" id="livetype" value="工作地住所">工作地住所
                              <input type="radio"  name="livetype" id="livetype" value="其他住宅">其他住宅
                              <input type="radio"  name="livetype" id="livetype" value="无住宅">无住宅
                    </td>
                  </tr>
    
                  <tr class="text-center row">
                    <td class="col-sm-2">
                      本户现住房面积:
                    </td>
                    <td class="col-sm-4">
                      <input type="text" class="form-control"  name="area" id="area" placeholder="请输入数字(平方米)">
                    </td>
                    </tr>
                    <tr>
                    <td class="col-sm-2 ">
                      本户现住房间数:
                    </td>
                    <td class="col-sm-4">
                      <input type="text" class="form-control"  name="roomnum" id="roomnum" placeholder="请输入数字(间)">
                    </td>
                  </tr>
    
                  <tr class="text-center row">
                    <td class="col-sm-2">
                      户主姓名
                    </td>
                    <td class="col-sm-4">
                      <input type="text" class="form-control"  name="name" id="name" placeholder="请输入户主姓名">
                    </td>
                     </tr>
    
                  <tr class="text-center row">
                    <td class="col-sm-2 ">
                      身份证号码
                    </td>
                    <td class="col-sm-4">
                      <input type="text" class="form-control"  name="idcard" id="idcard" placeholder="请输入身份证号码">
                    </td>
                  </tr>
    
                  <tr class="text-center row">
                    <td class="col-sm-2">
                      性别
                    </td>
                    <td class="col-sm-4">
                      <input type="radio"  name="sex" id="sex" value="男"><input type="radio"  name="sex" id="sex" value="女"></td>
                     </tr>
    
                  <tr class="text-center row">
                    <td class="col-sm-2">
                      民族
                    </td>
                    <td class="col-sm-4">
                      <input type="text" class="form-control"  name="nation" id="nation" placeholder="民族">
                    </td>
                  </tr>
    
                  <tr class="text-center row">
                    <td>
                      受教育程度
                    </td>
                    <td colspan="3">
                      <select class="form-control" id="education" name="education">
                        <option value="研究生">研究生</option>
                        <option value="大学本科">大学本科</option>
                        <option value="大学专科">大学专科</option>
                        <option value="高中">高中</option>
                        <option value="初中">初中</option>
                        <option value="小学">小学</option>
                        <option value="未上过学">未上过学</option>
                      </select>
                    </td>
                  </tr>
                </table>
                <input type="submit" value="添加"  onclick= "return check()" /> 
          </form> 
        </div>
    </body>
    <script type="text/javascript">
            function check()                        //封装一个<body>中做成点击事件的函数
            {
                if(document.getElementById('area').value=='') {
                      alert('现住房面积不能为空!');
                      document.getElementById('area').focus();
                      return false;
                     }
                else if(document.getElementById('area').value%1!=0){
                    alert('住房面积不是整数!');
                    return false;
                }
                if(document.getElementById('roomnum').value=='') {
                    alert('现住房间数不能为空!');
                    document.getElementById('roomnum').focus();
                    return false;
                   }
                else if(document.getElementById('roomnum').value%1!=0){
                    alert('现住房间数不是整数!');
                    return false;
                }
                if(document.getElementById('name').value=='') {
                    alert('户主姓名不能为空!');
                    document.getElementById('name').focus();
                    return false;
                   }
                
                if(document.getElementById('idcard').value.length!=18) {
                    alert('身份证号码位数错误!');
                    document.getElementById('idcard').focus();
                    return false;
                   }
                if(document.getElementById('nation').value=='') {
                    alert('民族不能为空!');
                    document.getElementById('nation').focus();
                    return false;
                   }
            }
            
        </script>
    </html>
  • 相关阅读:
    hi.baidu.com 百度流量统计
    Autofac is designed to track and dispose of resources for you.
    IIS Manager could not load type for module provider 'SharedConfig' that is declared in administration.config
    How to create and manage configuration backups in Internet Information Services 7.0
    定制swagger的UI
    NSwag在asp.net web api中的使用,基于Global.asax
    NSwag Tutorial: Integrate the NSwag toolchain into your ASP.NET Web API project
    JS变量对象详解
    JS执行上下文(执行环境)详细图解
    JS内存空间详细图解
  • 原文地址:https://www.cnblogs.com/ltw222/p/13965657.html
Copyright © 2011-2022 走看看