移動(dòng)端日期插件Mobiscroll.js使用詳解
更新時(shí)間:2016年12月19日 10:12:53 作者:Zerone1993
這篇文章主要為大家詳細(xì)介紹了移動(dòng)端日期插件Mobiscroll.js的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
mobiscroll js日期插件的基礎(chǔ)入門案例,移動(dòng)端開發(fā)過程中可能會(huì)用到。
<html> <head> <meta charset="UTF-8"> <title>mobiscroll</title> <link type="text/css" rel="stylesheet" href="../js/mobiscroll.custom-2.6.2.min.css" /> </head> <body> <!--mobiscroll會(huì)將表單控件的value屬性與插件的輸入值綁定--> <input id="date" name="date" /><br /> <input id="time" name="time" /><br /> <input type="button" value="showTime" onclick="showTime()"> <!--一般將js腳本文件放在body元素的底部就是為了加快網(wǎng)頁的加載,因?yàn)榫W(wǎng)頁的加載和腳本的加載是分開的--> <script src="../js/jquery-3.1.0.js"></script> <script src="../js/mobiscroll.custom-2.6.2.min.js"></script> <script> //初始化日期控件 /** 日期控件 start */ var now = new Date(); var currYear = now.getFullYear(); var currMonth = now.getMonth() + 1; var currDay = now.getDate(); //mobiScroll插件選項(xiàng) var opt1 = { preset : 'date', //日期,可選:date\datetime\time\tree_list\image_text\select theme : 'android-ics light', //皮膚樣式,可選:default\android\android-ics light\android-ics\ios\jqm\sense-ui\wp light\wp display : 'modal', //顯示方式 ,可選:modal\inline\bubble\top\bottom mode : 'scroller', //日期選擇模式,可選:scroller\clickpick\mixed lang : 'zh', dateFormat : 'yyyy-mm-dd', // 面板日期格式 setText : '確認(rèn)', //確認(rèn)按鈕名稱 cancelText : '取消', //取消按鈕名籍我 dateOrder : 'yyyymmdd', //面板中日期排列格式 dayText : '日', monthText : '月', yearText : '年', //面板中年月日文字 showNow : false, nowText : "今", endYear: currYear +100, //結(jié)束年份 minDate: new Date(currYear, currMonth - 1, currDay+1), onSelect:function(textVale,inst){ //選中時(shí)觸發(fā)事件 console.log("我被選中了....."); }, onClose:function(textVale,inst){ //插件效果退出時(shí)執(zhí)行 inst:表示點(diǎn)擊的狀態(tài)反饋:set/cancel console.log("textVale--"+textVale); console.log(this.id);//this表示調(diào)用該插件的對(duì)象 } }; //時(shí)間面板顯示日期 \$("#date").mobiscroll().date(opt1); //面板顯示時(shí)間 \$("#time").mobiscroll().time(opt1); function showTime(){ alert($('#date').val()); } </script> </body> </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
JavaScript實(shí)現(xiàn)內(nèi)容滾動(dòng)與導(dǎo)航標(biāo)簽互動(dòng)關(guān)聯(lián)方案
這篇文章主要介紹了JavaScript實(shí)現(xiàn)內(nèi)容滾動(dòng)與導(dǎo)航標(biāo)簽互動(dòng)關(guān)聯(lián)方案,主要根據(jù)滾動(dòng)左側(cè)內(nèi)容,關(guān)聯(lián)激活右側(cè)導(dǎo)航節(jié)點(diǎn)展開相應(yīng)介紹,需要的小伙伴可以參考一下2022-06-06JS實(shí)現(xiàn)星星評(píng)分功能實(shí)例代碼(兩種方法)
這篇文章主要介紹了JS實(shí)現(xiàn)星星評(píng)分功能實(shí)例代碼(兩種方法)的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06JS實(shí)現(xiàn)將手機(jī)號(hào)中間的幾位數(shù)字變成****功能
這篇文章主要介紹了用js如何實(shí)現(xiàn)將手機(jī)號(hào)中間的幾位數(shù)字變成****?_,今天,我們要實(shí)現(xiàn)一個(gè)很常見并且簡(jiǎn)單的功能如何將手機(jī)號(hào)中間的幾位數(shù)變成****,需要的朋友可以參考下2023-09-09