代碼&資源文件: jq時間控件.rarjavascript
//引入資源文件 <link rel="stylesheet" type="text/css" href="./src/mobiscroll-3.0.0.min.css"> <script type="text/javascript" src="./src/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="./src/mobiscroll-3.0.0.min.js"></script> <div> <input style="width: 180px; background-color: #ffffff;" placeholder="" value="" id="start-time"> <span class="pull-left" style="height: 34px; line-height: 34px;"> - </span> <input style="width: 180px; background-color: #ffffff;" placeholder="" value="" id="end-time"> </div> <script type="text/javascript"> $(function(){ var now = new Date(), minDate = new Date(now.getFullYear() - 20, now.getMonth(), now.getDate()), maxDate = new Date(now.getFullYear() + 20, now.getMonth(), now.getDate()); mobiscroll.datetime('#start-time,#end-time', { theme: 'mobiscroll', lang: 'zh', display: 'center', min: minDate, max: maxDate }); }); </script>