|
能够同时选择日期和时间的第三方控件第一步,先引用JS和CSS 注:JSS与CSS会上传上来的。
<link rel="stylesheet" href="../css/mobiscroll.custom-2.17.1.min.css" />
<script type="text/javascript" src="../script/jquery-1.11.0.js"></script>
<script type="text/javascript" src="../script/mobiscroll.min.js"></script>
HTML代码(样式我就不写了)
<body>
<table>
<tr>
<td class="td_img"><img src="../image/img/calendar1.png" /></td>
<td class="time"><span>开始时间:</span></td>
<td>
<input id="demob" placeholder="请选择时间" />
</td>
</tr>
<tr>
<td class="td_img"><img src="../image/img/calendar1.png" /></td>
<td><span>结束时间:</span></td>
<td>
<input id="demoe" placeholder="请选择时间" />
</td>
</tr>
</table>
</body>
JS代码
//选择时间开始时间
$(function() {
var now = new Date();
$('#demob').mobiscroll().datetime({
theme : 'android-holo-light',
lang : 'zh',
display : 'bottom',
dateOrder : 'yymmdd',
//timeFormat: 'HH:ii',
showLabel : true,
timeWheels : 'HHii',
seconds : false,
minDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30),
maxDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() + 30)
});
});
//选择时间结束时间
$(function() {
var now = new Date();
$('#demoe').mobiscroll().datetime({
theme : 'android-holo-light',
lang : 'zh',
display : 'bottom',
dateOrder : 'yymmdd',
//timeFormat: 'HH:ii',
showLabel : true,
timeWheels : 'HHii',
seconds : false,
minDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() - 30),
maxDate : new Date(now.getFullYear(), now.getMonth(), now.getDate() + 30)
});
});
以上就是选择日期时间的代码,效果图如下
附件:
|
本帖子中包含更多资源,您需要 登录 才可以下载或查看,没有帐号?立即注册
X
|