createUser

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>itHelpDesk</title>
<script type="text/javascript" src="../JS/jquery-1.6.4.js"></script>
<link rel="stylesheet" href="../CSS/create_user.css" type="text/css">
<script type="text/javascript" src="../JS/create_user.js"></script>
</head>
<body>
    <div id="warp">
      <div id="content">
        <h3 id="new"><a href="../user/userList.action">Home > </a>Create A User</h3>
        <div id="shadow">
         
          <div id="create">
            <form action="../user/create.action" method = "post">
              <div>
                <h3>Name: </h3>
                <input name="name" id="name"><span id="name_input"></span>
              </div>
              <div>
                <h3>Email:</h3>
                <input name="email" id="email"><span id="email_input"></span>
              </div>
              <div>
                <h3>Role:</h3>
                <select name="roleId" id="role">
                  <option value="0">please select role</option>
                  <option value="1">Engineer</option>
                  <option value="3">SDM</option>
                  <option value="5">IT_Staff</option>
                </select>
                <span id="role_select"></span>
              </div>
              <div id="button_left">
                <button id = "submit">Submit</button>
                <button id = "cancel">Cancel</button>
              </div>
            </form>
        </div>
        </div>      
       </div>
    </div>
</body>
</html>



button {
    border: 0px;
}
#content {
  min-height: 450px;
  width: 960px;
  margin: 0px auto;
  position: relative;
  padding: 50px 20px 20px 20px;
}

#shadow {
    background-color: rgba(211, 212, 213, 0.06);
    margin: 0 auto;
    border-radius: 10px;
    height: 400px;
    padding-top: 20px;
}


#type {
    width: 400px;
height: 30px;
border-radius: 3px;
border: 1px solid #BFBFBF;
}

h3 {
    font-size: 14px;
    line-height: 0px;
}


#create input, #create select {
    width: 400px;
    height: 30px;
    border-radius: 3px;
    border: 1px solid #BFBFBF;
}

#title {
    width: 400px;
    height: 30px;
    border-radius: 3px;
    border: 1px solid #BFBFBF;
}

span {
    display: block;
    font-size: 12px;
    color: red;
    height: 15px;
}


#button_left button {
    width: 80px;
    height: 30px;
    margin-top: 30px;
    margin-left: 30px;
    background: url(../images/btn_normal_80x30.png) center 0px no-repeat;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

#button_left {
    margin-left: 70px;
}

#new a {
    font-size: 14px;
    font-family: Arial;
    font-weight: normal;
}

a {
    text-decoration: none;
    color: #418FB5;
}

#create {
    width: 400px;
    margin: 0 auto;
}


$(document).ready(function(){
    $("#submit").click(function(){
    if ($("#name").val() == "") {
    $("#name_input").html("Please input name!");
    return false;
    }
    if ($("#name").val() > 30) {
    $("#name_input").html("name cannot be over 30 character!");
    return false;
    }
    var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
    var email_val = $("#email").val();
   
    if (!search_str.test(email_val)) {
   
    $("#email_input").html("Please input right email!");
    return false;
    }
    if ($("#role").val() == 0) {
    $("#role_input").html("Please select the role type!");
    return false;
    }
        $("#create").submit();
        return true;
    });
    $("#name").blur(function(){
   
    if ($("#name").val() == "") {
    $("#name_input").html("Please input name!");
    return false;
    }
    if ($("#name").val() > 30) {
    $("#name_input").html("name cannot be over 30 character!");
    return false;
    }
    $("#name_input").html("");
    return false;
    });
    $("#email").blur(function(){
    var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
    var email_val = $("#email").val();
   
    if (!search_str.test(email_val)) {
   
    $("#email_input").html("Please input right email!");
    return false;
    }
   
    $("#email_input").html("");
    return false;
    });
   
    $("#role").change(function(){
    if ($("#role").val() == 0) {
    $("#role_input").html("Please select the role type!");
    return false;
    }
    $("#role_input").html("");
    return false;
    });
    $("#cancel").click(function(){
        location.href = "../user/userList.action";
        return false;
    });
    $("#role").change(function(){
        var roleId = $("#role").val();
        if (roleId != "1") {
            $("#managerId").remove();
            $("#manager").remove();
            return false;
        }
        var url = '../ajax/getManager.action?roleId='+roleId;
        $.getJSON(url,function(result){
            $.each(result, function(i, field){
               $("#role_select").after("<h3 id='manager'>Manager:</h3><select name='managerId' id='managerId'></select>")
               for (var j = 0; j < field.length; j++) {
                     $("#managerId").append("<option value=" + field[j].id + ">" + field[j].name + "</option>");
               }
            });
        });
    });
});

你可能感兴趣的:(html)