This repository was archived by the owner on Aug 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincrease.html
51 lines (49 loc) · 1.96 KB
/
increase.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./css/alter.css">
<link rel="shortcut icon" href="./image/rocken.ico" type="image/x-icon" />
</head>
<body>
<br><br>
<h1>添加员工信息</h1>
<form id="postForm" action="">
<label for="id">员工编号</label>
<input type="text" id="id"><br>
<label for="name">员工姓名</label>
<input type="text" id="name"><br>
<label for="idCard">身份证号</label>
<input type="text" id="idCard"><br>
<label for="isFree">是否空闲</label>
<input type="text" id="isFree"><br>
<label for="isHealth">健康状况</label>
<input type="text" id="isHealth"><br>
<input type="submit" value="提交" class="submit">
<input type="reset" value="重置" class="reset">
</form>
<script>
document.getElementById('postForm').addEventListener('submit',postForm);
function postForm(e){
e.preventDefault();
var name = document.getElementById("name").value;
var id = document.getElementById("id").value;
var idCard = document.getElementById("idCard").value;
var isFree = document.getElementById("isFree").value;
var isHealth = document.getElementById("isHealth").value;
var params= "name="+name+"&id="+id+"&idCard="+idCard+"&isFree="+isFree+"&isHealth="+isHealth;
var xhr = new XMLHttpRequest();
xhr.open('POST',"increase.php",true);
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhr.onload = function(){
console.log(this.responseText);
}
xhr.send(params);
alert('提交成功');
}
</script>
</body>
</html>