<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js网页日期插件</title>
<script type="text/javascript" src="js/laydate.js"></script>
<style type="text/css">
*{margin:0;padding:0;list-style:none;}
html{background-color:#E3E3E3; font-size:14px; color:#000; font-family:'微软雅黑'}
h2{line-height:30px; font-size:20px;}
a,a:hover{ text-decoration:none;}
pre{font-family:'微软雅黑'}
.box{width:970px; padding:10px 20px; background-color:#fff; margin:10px auto;}
.box a{padding-right:20px;}
.demo1,.demo2,.demo3,.demo4,.demo5,.demo6{margin:25px 0;}
h3{margin:10px 0;}
.layinput{height: 22px;line-height: 22px;width: 150px;margin: 0;}
</style>
</head>
<body>
<div class="box">
<div class="demo1">
<h3>演示二(普通模式)</h3>
<input class="laydate-icon" id="demo" value="2014-6-25更新">
</div>
<div class="demo2">
<h3>演示一(日期精确到秒)</h3>
<input placeholder="请输入日期" class="laydate-icon" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
</div>
<div class="demo3">
<h3>演示三(日期范围限制)</h3>
<ul class="inline" id="demo">
开始日:<input class="laydate-icon" value="2014-6-25更新">
结束日:<input class="laydate-icon" value="2014-6-25更新">
</ul>
</div>
<div class="demo4">
<h3>演示四(自定义日期格式)</h3>
<div id="test1" class="inline laydate-icon" style="width:150px;"></div>
</div>
<div class="demo5">
<h3>演示五(日期范围限定在昨天到明天)</h3>
<div class="inline laydate-icon" style="width:150px;" id="hello3"></div>
</div>
<div class="demo6">
<h3>演示六(按钮触发日期)</h3>
<input readonly class="layinput" id="hello1">
<div class="laydate-icon " onClick="laydate({elem: '#hello1'});" style="width:10px;display:inline-block;border:none;"></div>
</div>
</div>
<script type="text/javascript">
!function(){
laydate.skin('molv');
laydate({elem: '#demo'});
}();
var start = {
elem: '#start',
format: 'YYYY-MM-DD',
min: laydate.now(),
max: '2099-06-16',
istime: true,
istoday: false,
choose: function(datas){
end.min = datas;
end.start = datas
}
};
var end = {
elem: '#end',
format: 'YYYY-MM-DD',
min: laydate.now(),
max: '2099-06-16',
istime: true,
istoday: false,
choose: function(datas){
start.max = datas;
}
};
laydate(start);
laydate(end);
laydate({
elem: '#test1',
format: 'YYYY年MM月DD日',
festival: true,
choose: function(datas){
alert('得到:'+datas);
}
});
laydate({
elem: '#hello3',
min: laydate.now(-1),
max: laydate.now(+1)
});
</script>
</body>
</html>