-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (46 loc) · 1.86 KB
/
index.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
<!DOCTYPE html>
<html>
<head lang="zh">
<meta charset="UTF-8">
<title></title>
<meta name="viewport"
content="width=device-width,initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="mobile-web-app-capable" content="yes"/>
<meta name="apple-touch-fullscreen" content="yes"/>
<link rel="stylesheet" href="number-keyboard.css">
<style>
* {
padding: 0;
margin: 0;
}
p{
padding: 10px;
line-height: 30px;
}
label{
display: inline-block;
}
input{
display: inline-block;
width: 200px;
height: 28px;
border: 1px solid #e6e6e6;
border-radius: 5px;
text-align: center;
}
</style>
</head>
<body>
<p><label for="value_1">数值1:</label><input type="text" id="value_1" class="number-input" value="2.1" readonly></p>
<p><label for="value_2">数值2:</label><input type="text" id="value_2" class="number-input" value="100" readonly></p>
<p><label for="value_3">数值3:</label><input type="text" id="value_3" class="number-input" value="0.3" readonly></p>
<script src="number-keyboard.js"></script>
<script>
new NumberInput(document.getElementsByClassName('number-input')[0], {title: '请输入数值1:', canceled: function(){ console.log('取消...'); }, unitName: '元'});
new NumberInput(document.getElementsByClassName('number-input')[1], {title: '请输入数值2:', integer: true, confirmed: function(result){ console.log('当前确认的值为' + result); }});
new NumberInput(document.getElementsByClassName('number-input')[2], {title: '请输入数值3:'});
</script>
</body>
</html>