-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (83 loc) · 3.38 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
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>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="datepicker.css" />
<script type="text/javascript" src="js/components/mls-validate.js" ></script>
<script type="text/javascript" src="js/components/mls-datepicker.js"></script>
<script type="text/javascript" src="js/components/mls-dialog.js"></script>
</head>
<body>
<input type="text" id="name"/><span id="name-msg"></span>
<input type="text" id="age" /><span id="age-msg"></span>
<script>
var v = new Validator();
v.addElement('name').addRules([{require: true},{minLen:5},{maxLen:12},{zc:new RegExp('^zczczc$','g')},{test: function(){return true;}},{remote: {url:'http://www.baidu.com',params:{a:1,b:2}}}]).addMessages({require:"shuru",test:'test',minLen:'最短5',maxLen:'最长12',zc:'zcshuru',remote:"name valid"}).setMessageNode('name-msg').listen('beforeValidate', function(){console.log('beforeValidate')}).afterValidate(function(){console.log('after')});
v.addElement('age').addRules([{min:3}, {max:20}]).addMessages({min:'最小3',max:'最大20'}).setMessageNode('age-msg');
</script>
<br/>
<input type="text" id="startTime"/>
<input type="text" id="endTime"/>
<input type="text" id="bindTime1"/>
<input type="text" id="bindTime2"/>
<input type="button" id="alertDig" value="警告框"/>
<input type="button" id="confirmDig" value="确认框"/>
<input type="button" id="promptDig" value="输入提示框"/>
<input type="button" id="dialog" value="普通对话框"/>
<script type="text/javascript">
var start = new Datepicker({
ele : "startTime",
limit : function(year, month, day){
var now = new Date();
return year > now.getFullYear() || (year == now.getFullYear() && month > now.getMonth()) || (year == now.getFullYear() && month == now.getMonth() && day >= now.getDate()) || false
}
});
var end = new Datepicker({
ele : "endTime",
hasTime : true,
format : "yyyy-MM-dd HH:mm:ss",
limit : function(year, month, day){
var now = start.getVal();
return year > now.getFullYear() || (year == now.getFullYear() && month > now.getMonth()) || (year == now.getFullYear() && month == now.getMonth() && day >= now.getDate()) || false
}
});
start.listen('selected', function(){
end.refresh();
});
Datepicker.bind({
ele : "bindTime1",
hasTime : true,
format : "yyyy-MM-dd HH:mm:ss"
});
Datepicker.bind({
ele : "bindTime2",
format : "yyyy-MM-dd"
});
Dialog.utils.dom.addEvent('alertDig', 'click', function(){
Dialog.alert({
msg: "删除成功",
isModal: false
}, function(flag){ console.log(flag)});
});
Dialog.utils.dom.addEvent('confirmDig', 'click', function(){
Dialog.confirm({
msg: "确定删除***?"
}, function(flag){ alert(flag)});
});
Dialog.utils.dom.addEvent('promptDig', 'click', function(){
Dialog.prompt({
msg: "请输入价格:"
}, function(flag, data, container){ console.log(data)});
});
Dialog.utils.dom.addEvent('dialog', 'click', function(){
Dialog.open({
msg: "请选择商品",
url: "dialog.html",
width: "auto",
onload: function(){ alert()}
}, function(flag){ console.log(flag)});
});
</script>
</body>
</html>