tk.html
2.3 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单弹窗</title>
<style>
/* 遮罩层样式 */
.overlay1 {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
display: none; /* 默认隐藏 */
}
/* 弹窗样式 */
.popup1 {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
display: none; /* 默认隐藏 */
}
label {
width: 100px;
margin-bottom: 10px;
}
input[type="text"], select {
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
color: #555;
}
select option {
color: #555;
}
button {
padding: 5px 10px;
border-radius: 3px;
border: none;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
button:hover {
background-color: #0069d9;
}
</style>
</head>
<body>
<button id="openbtn">添加</button>
<div class="overlay" id="overlay"></div>
<div class="popup" id="popup">
<form>
<label>
序号:
</label>
<input type="text" value="" placeholder="请输入ID"/><br><br>
<label>名称:</label>
<input type="text" value="" placeholder="请输入名称" /><br><br>
<label>类型</label>
<select>
<option>1</option>
<option>2</option>
</select><br><br>
<button id="closebtn()">关闭</button>
<button type="submit">提交</button>
</form>
</div>
<script>
const openbtn=document.getElementById('openbtn');
const closebtn=document.getElementById('closebtn');
const popup=document.getElementById('popup');
const overlay=document.getElementById('overlay');
openbtn.addEventListener('click',function(){
popup.style.display='block';
overlay.style.display='block';
})
</script>
</body>
</html>