-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdialog.html
116 lines (107 loc) · 2.77 KB
/
dialog.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Title</title>
<style>
html,body {
margin: 0;
padding: 0;
}
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
text-decoration: none;
}
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
#cover{
width: 100%;
height: 100%;
background-color: dimgray;
display: none;
z-index: 10;
position: absolute;
top:0;
opacity:0.3;
}
dialog {
min-width: 300px;
border: 1px dashed #000;
border-radius: 1rem;
z-index: 11;
}
dialog input{
width: 100%;
height: 1.5rem;
border-radius: 4px;
}
</style>
</head>
<body>
<br>
<br>
<center>
<button class="btn btn-success" onclick="dialogShow()">打开窗口</button>
</center>
<!-- 模态框 -->
<div id="cover"></div>
<dialog id="modal">
<p>操作</p>
<hr>
<input type="hidden" id="uid">
<p>
用户名: <br>
<input type="text" id="username">
</p>
<p>
年 龄: <br>
<input type="text" id="age">
</p>
<p style="float: right">
<button class="btn btn-default" onclick="dialogHide()">关闭</button>
<button class="btn btn-success" onclick="return false">提交</button>
</p>
</dialog>
<script>
var dialog = document.getElementById("modal")
var cover = document.getElementById("cover")
function dialogHide() {
cover.style.display = "none"
dialog.close()
}
function dialogShow() {
cover.style.display = "block"
dialog.show()
}
</script>
</body>
</html>