這篇文章將為大家詳細講解有關(guān)Bootstrap中如何配置使用時間日歷插件bootstrap-datetimepicker,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站建設(shè)、做網(wǎng)站、新樂網(wǎng)絡(luò)推廣、微信小程序定制開發(fā)、新樂網(wǎng)絡(luò)營銷、新樂企業(yè)策劃、新樂品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供新樂建站搭建服務(wù),24小時服務(wù)熱線:028-86922220,官方網(wǎng)址:jinyejixie.com
1. 測試環(huán)境
win7
JQuery-3.2.1.min.js
下載地址:
https://gitee.com/ishouke/front_end_plugin/blob/master/jquery-3.2.1.min.js
Bootstrap-3.3.7-dist
下載地址:
https://gitee.com/ishouke/front_end_plugin/blob/master/bootstrap-3.3.7.zip
bootstrap-table-develop-v1.12.1.zip
下載地址:
https://github.com/wenzhixin/bootstrap-table
https://gitee.com/ishouke/front_end_plugin/blob/master/bootstrap-table-develop-v1.12.1.zip
bootstrap-datetimepicker-master-v4.17.47.zip
下載地址:
https://github.com/Eonasdan/bootstrap-datetimepicker
1.2. 配置與應(yīng)用
效果展示
HTML代碼片段
head設(shè)置
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 上述3個meta標簽*必須*放在最前面,任何其他內(nèi)容都*必須*跟隨其后! --> {% load staticfiles %} <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依賴 jQuery,所以必須放在前邊) --> <script type="text/javascript" src="{% static 'website/jquery-3.2.1.min.js' %}" defer></script> <!-- Bootstrap --> <link rel="stylesheet" type="text/css" href="{% static 'website/bootstrap-3.3.7-dist/css/bootstrap.min.css' %}" rel="external nofollow" /> <!-- 加載 Bootstrap 的所有 JavaScript 插件。你也可以根據(jù)需要只加載單個插件。 --> <script type="text/javascript" src="{% static 'website/bootstrap-3.3.7-dist/js/bootstrap.min.js' %}" defer></script> <!-- HTML5 shim 和 Respond.js 是為了讓 IE8 支持 HTML5 元素和媒體查詢(media queries)功能 --> <!-- 警告:通過 file:// 協(xié)議(就是直接將 html 頁面拖拽到瀏覽器中)訪問頁面時 Respond.js 不起作用 --> <!--[if lt IE 9]> <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js" defer></script> <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js" defer></script> <![endif]--> ……略 <!-- bootstrap-datetimepicker --> <link rel="stylesheet" href="{% static 'website/bootstrap-datetimepicker-4.17.47/css/bootstrap-datetimepicker.min.css' %}" rel="external nofollow" /> <script type="text/javascript" src="{% static 'website/bootstrap-datetimepicker-4.17.47/js/bootstrap-datetimepicker.min.js' %}" defer></script> <!-- 引入中文語言包,注意:locale files 必須放在bootstrap-datetimepicker.min.js后面 --> <script type="text/javascript" src="{% static 'website/bootstrap-datetimepicker-4.17.47/js/locales/bootstrap-datetimepicker.zh-CN.js' %}" defer></script> ……略 </head>
toolbar工具條
<div class="container-fluid"> <div class="row"> <table id="roleTable"></table> <div id="toolbar"> <div class="btn-group"> <button class="btn btn-default" data-toggle="modal" data-target="#roleDialog" id="addBtn">新增 <i class="glyphicon glyphicon-plus"></i> </button> <button class="btn btn-default" id="editBtn">修改 <i class="glyphicon glyphicon-edit"></i> </button> <button class="btn btn-default" id="deleteBtn">刪除 <i class="glyphicon glyphicon-remove"></i> </button> </div> <form class="form-inline" id="queryForm"> <div class="form-group"> <div class="input-group"> <div class="input-group-addon">角色名稱</div> <input type="text" class="form-control" name="roleNameQ" id="roleNameQ" placeholder="請輸入角色名稱"> </div> <div class="input-group date" id="startTimePicker"> <div class="input-group-addon">開始時間</div> <input type="text" class="form-control" name="startTime" id="startTime" > <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> <div class="input-group date" id="endTimePicker"> <div class="input-group-addon">結(jié)束時間</div> <input type="text" class="form-control" name="endTime" id="endTime"> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <button type="button" id="queryBtn" class="btn btn-primary queryButton">查詢</button> </form> </div> </div> </div>
JS代碼片段
時間插件配置
// 設(shè)置開始時間插件 $('#' + startTimePickerID).datetimepicker({ language: 'zh-CN',// 默認值: 'en',設(shè)置控件上的文案為中文 format:'yyyy-mm-dd HH:mm:ss', //格式化,以便精確到秒 autoclose:true // 選擇時間時,點擊分后,關(guān)閉時間插件框 }); // 設(shè)置結(jié)束時間插件 $('#' + endTimePickerID).datetimepicker({ language: 'zh-CN', format:'yyyy-mm-dd HH:mm:ss', autoclose: true // 選擇時間時,點擊分后,關(guān)閉時間插件框} });
關(guān)于“Bootstrap中如何配置使用時間日歷插件bootstrap-datetimepicker”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
網(wǎng)站欄目:Bootstrap中如何配置使用時間日歷插件bootstrap-datetimepicker
文章起源:http://jinyejixie.com/article48/johghp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、品牌網(wǎng)站建設(shè)、用戶體驗、外貿(mào)網(wǎng)站建設(shè)、定制開發(fā)、動態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)