【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
引用css样式,经测试这几个样式都要使用
<link href="../../plugins/Mobiscroll/css/mobiscroll_002.css" rel="stylesheet" type="text/css">
<link href="../../plugins/Mobiscroll/css/mobiscroll.css" rel="stylesheet" type="text/css">
<link href="../../plugins/Mobiscroll/css/mobiscroll_003.css" rel="stylesheet" type="text/css">
引用jquery 及js
<script src="../../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="../../plugins/Mobiscroll/js/mobiscroll_002.js" type="text/javascript"></script>
<script src="../../plugins/Mobiscroll/js/mobiscroll_004.js" type="text/javascript"></script>
<script src="../../plugins/Mobiscroll/js/mobiscroll.js" type="text/javascript"></script>
<script src="../../plugins/Mobiscroll/js/mobiscroll_003.js" type="text/javascript"></script>
<script src="../../plugins/Mobiscroll/js/mobiscroll_005.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var currYear = (new Date()).getFullYear();
var opt={};
opt.date = {preset : 'date'};
opt.datetime = {preset : 'datetime'};
opt.time = {preset : 'time'};
opt.default = {
theme: 'android-ics light', //皮肤样式
display: 'modal', //显示方式
mode: 'scroller', //日期选择模式
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:ii:ss',//含有秒需要timeFormat和timeWheels
timeWheels: 'hhiiss',
lang: 'zh',
showNow: true,
nowText: "今天",
startYear: currYear - 10, //开始年份
endYear: currYear + 10 //结束年份
};
opt.default1 = {
theme: 'android-ics light', //皮肤样式
display: 'modal', //显示方式
mode: 'scroller', //日期选择模式
dateFormat: 'yy-mm-dd',lang: 'zh',
showNow: true,
nowText: "今天",
startYear: currYear - 10, //开始年份
endYear: currYear + 10 //结束年份
};$("#appDate").mobiscroll($.extend(opt['date'], opt['default']));
var optDateTime = $.extend(opt['datetime'], opt['default']);
var optTime = $.extend(opt['time'], opt['default1']);
$("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
$("#appTime").mobiscroll(optTime).time(optTime);
});
</script>
特别注意如果需要含有秒,需要设置参数 timeFormat: 'HH:ii:ss',timeWheels: 'hhiiss',如果timeWheels: 'HHiiss', //24小时制
dateFormat不能写成: 'yyyy-mm-dd',要写成'yy-mm-dd',否则默认的时间与点击文本框弹出的时间面板不一致
来源:oschina
链接:https://my.oschina.net/u/2612473/blog/713657