在htm中bootstrap+datetimepicker怎么样设置默认时间
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在htm中bootstrap+datetimepicker怎么样设置默认时间相关的知识,希望对你有一定的参考价值。
首先,不管是datepicker还是datetimepicker,都是bootstrap爱好者编写的,并不是twitter官方提供的。
你想设置默认时间,其实使用value属性就可以了,这与datetimepicker无关,只是input本身的属性:
<input type="text" value="26/08/2013 19:14:58" data-format="dd/MM/yyyy hh:mm:ss" id="dp2">$('#dp2').datetimepicker ();以上会使默认时间设置为26/08/2013 19:14:58,如果你希望默认时间为当前时间,使用DOM操作下input的value属性就可以了。
也就是说并没有提供特定的属性来给表单设置系统当前时间
不过还是谢谢哦
是的 datetimepicker没有属性直接提供当前时间,但是js里有Date()来获取当前详细的日期和时间,你要获取也很简单。PS:如果回答满意,请点采纳~
参考技术A html代码:<input class="controls input-append date form_date" type="text" id="dayReport" value="new Date()"/>JS代码:
$('#dayReport').val(new Date().Format('yyyy-MM-dd'));
通过设置input标签的value值,可以实现datetimepicker 的默认显示当前系统日期
Format是一个格式化日期的代码:
var o =
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
;
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
如果解决了您的问题,请点个赞!!!
bootstrap中使用日历控件
在bootstrap中使用日历控件可以参照以下资料:
http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm
以下是参照此资料自己做的一个demo:
关于资料中的依赖,截图如下:
关于把Less编译成css,需要安装node, 需要注意的是要定位到build文件夹,然后执行 lessc build_standalone.less datetimepicker.css
大概意思就是把build_standalone.less转换成css文件,并保存在datetimepicker.css文件中
关于Less本人了解的也不多,具体可以参考资料:
http://lesscss.org/#using-less
https://www.ibm.com/developerworks/cn/web/1207_zhaoch_lesscss/
具体的代码如下,html代码如下:
<!DOCTYPE html> <html> <head> <title>BootStrap欢迎你</title> <!-- <link rel=‘stylesheet‘ href=‘/stylesheets/bootstrap-responsive.min.css‘ /> --> <link rel=‘stylesheet‘ href=‘/stylesheets/bootstrap.css‘ /> <link rel=‘stylesheet‘ href=‘/stylesheets/datetimepicker.css‘ /> <style> body{ position: relative; padding-top:40px; } </style> </head> <body> <div class="input-append date form_datetime"> <input size="16" type="text" value="" readonly> <span class="add-on"><i class="icon-th"></i></span> </div> <script src="/javascripts/jquery-2.1.4.min.js" type="text/javascript"></script> <script src="/javascripts/bootstrap.js" type="text/javascript"></script> <script src="/javascripts/bootstrap-datetimepicker.js" type="text/javascript"></script> <script src="/javascripts/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script> <script type="text/javascript"> $(".form_datetime").datetimepicker({ format: "yyyy-mm-dd hh:ii", autoclose: true, todayBtn: true, language:‘zh-CN‘, pickerPosition:"bottom-left" }); </script> </body> </html>
/*! * Datetimepicker for Bootstrap * * Copyright 2012 Stefan Petre * Improvements by Andrew Rowls * Improvements by Sébastien Malot * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * */ .datetimepicker { padding: 4px; margin-top: 1px; white-space: normal; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; direction: ltr; } .datetimepicker.datetimepicker-rtl { direction: rtl; } .datetimepicker.datetimepicker-rtl table tr td span { float: right; } .datetimepicker > div { display: none; } .datetimepicker.minutes div.datetimepicker-minutes { display: block; } .datetimepicker.hours div.datetimepicker-hours { display: block; } .datetimepicker.days div.datetimepicker-days { display: block; } .datetimepicker.months div.datetimepicker-months { display: block; } .datetimepicker.years div.datetimepicker-years { display: block; } .datetimepicker table { margin: 0; } .datetimepicker table tr td.minute:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td.hour:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td.day:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td span { display: block; width: 23%; height: 54px; line-height: 54px; float: left; margin: 1%; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datetimepicker table tr td span:hover { background: #eeeeee; } .datetimepicker table tr td span.old { color: #999999; } .datetimepicker .datetimepicker-hours span { height: 26px; line-height: 26px; } .datetimepicker .datetimepicker-minutes span { height: 26px; line-height: 26px; } .datetimepicker th.switch { width: 145px; } .datetimepicker-inline { width: 220px; } .datetimepicker-dropdown, .datetimepicker-dropdown-left { top: 0; left: 0; } [class*="datetimepicker-dropdown"]:before { content: ‘‘; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; } [class*="datetimepicker-dropdown"]:after { content: ‘‘; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; } [class*="datetimepicker-dropdown-top"]:before { content: ‘‘; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 7px solid #ccc; border-top-color: rgba(0, 0, 0, 0.2); border-bottom: 0; }/*! * Datetimepicker for Bootstrap * * Copyright 2012 Stefan Petre * Improvements by Andrew Rowls * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * */ .datetimepicker { padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; direction: ltr; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datetimepicker-inline { width: 220px; } .datetimepicker.datetimepicker-rtl { direction: rtl; } .datetimepicker.datetimepicker-rtl table tr td span { float: right; } .datetimepicker-dropdown, .datetimepicker-dropdown-left { top: 0; left: 0; } .datetimepicker-dropdown:before { content: ‘‘; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 6px; } .datetimepicker-dropdown:after { content: ‘‘; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 7px; } .datetimepicker-dropdown-left:before { content: ‘‘; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; right: 6px; } .datetimepicker-dropdown-left:after { content: ‘‘; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; right: 7px; } .datetimepicker > div { display: none; } .datetimepicker.minutes div.datetimepicker-minutes { display: block; } .datetimepicker.hours div.datetimepicker-hours { display: block; } .datetimepicker.days div.datetimepicker-days { display: block; } .datetimepicker.months div.datetimepicker-months { display: block; } .datetimepicker.years div.datetimepicker-years { display: block; } .datetimepicker table { margin: 0; } .datetimepicker td, .datetimepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border: none; } .table-striped .datetimepicker table tr td, .table-striped .datetimepicker table tr th { background-color: transparent; } .datetimepicker table tr td.minute:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td.hour:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td.day:hover { background: #eeeeee; cursor: pointer; } .datetimepicker table tr td.old, .datetimepicker table tr td.new { color: #999999; } .datetimepicker table tr td.disabled, .datetimepicker table tr td.disabled:hover { background: none; color: #999999; cursor: default; } .datetimepicker table tr td.today, .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today.disabled:hover { background-color: #fde19a; background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); background-image: linear-gradient(top, #fdd49a, #fdf59a); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#fdd49a‘, endColorstr=‘#fdf59a‘, GradientType=0); border-color: #fdf59a #fdf59a #fbed50; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today:hover:hover, .datetimepicker table tr td.today.disabled:hover, .datetimepicker table tr td.today.disabled:hover:hover, .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today:hover.disabled, .datetimepicker table tr td.today.disabled.disabled, .datetimepicker table tr td.today.disabled:hover.disabled, .datetimepicker table tr td.today[disabled], .datetimepicker table tr td.today:hover[disabled], .datetimepicker table tr td.today.disabled[disabled], .datetimepicker table tr td.today.disabled:hover[disabled] { background-color: #fdf59a; } .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active { background-color: #fbf069 \9; } .datetimepicker table tr td.active, .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active.disabled:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#0088cc‘, endColorstr=‘#0044cc‘, GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active:hover:hover, .datetimepicker table tr td.active.disabled:hover, .datetimepicker table tr td.active.disabled:hover:hover, .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active:hover.disabled, .datetimepicker table tr td.active.disabled.disabled, .datetimepicker table tr td.active.disabled:hover.disabled, .datetimepicker table tr td.active[disabled], .datetimepicker table tr td.active:hover[disabled], .datetimepicker table tr td.active.disabled[disabled], .datetimepicker table tr td.active.disabled:hover[disabled] { background-color: #0044cc; } .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active { background-color: #003399 \9; } .datetimepicker table tr td span { display: block; width: 23%; height: 54px; line-height: 54px; float: left; margin: 1%; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datetimepicker .datetimepicker-hours span { height: 26px; line-height: 26px; } .datetimepicker .datetimepicker-hours table tr td span.hour_am, .datetimepicker .datetimepicker-hours table tr td span.hour_pm { width: 14.6%; } .datetimepicker .datetimepicker-hours fieldset legend, .datetimepicker .datetimepicker-minutes fieldset legend { margin-bottom: inherit; line-height: 30px; } .datetimepicker .datetimepicker-minutes span { height: 26px; line-height: 26px; } .datetimepicker table tr td span:hover { background: #eeeeee; } .datetimepicker table tr td span.disabled, .datetimepicker table tr td span.disabled:hover { background: none; color: #999999; cursor: default; } .datetimepicker table tr td span.active, .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active.disabled:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#0088cc‘, endColorstr=‘#0044cc‘, GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active:hover:hover, .datetimepicker table tr td span.active.disabled:hover, .datetimepicker table tr td span.active.disabled:hover:hover, .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active:hover.disabled, .datetimepicker table tr td span.active.disabled.disabled, .datetimepicker table tr td span.active.disabled:hover.disabled, .datetimepicker table tr td span.active[disabled], .datetimepicker table tr td span.active:hover[disabled], .datetimepicker table tr td span.active.disabled[disabled], .datetimepicker table tr td span.active.disabled:hover[disabled] { background-color: #0044cc; } .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active { background-color: #003399 \9; } .datetimepicker table tr td span.old { color: #999999; } .datetimepicker th.switch { width: 145px; } .datetimepicker thead tr:first-child th, .datetimepicker tfoot tr:first-child th { cursor: pointer; } .datetimepicker thead tr:first-child th:hover, .datetimepicker tfoot tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i { cursor: pointer; width: 14px; height: 14px; } [class*="datetimepicker-dropdown-top"]:after { content: ‘‘; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid #ffffff; border-bottom: 0; } .datetimepicker-dropdown-bottom-left:before { top: -7px; right: 6px; } .datetimepicker-dropdown-bottom-left:after { top: -6px; right: 7px; } .datetimepicker-dropdown-bottom-right:before { top: -7px; left: 6px; } .datetimepicker-dropdown-bottom-right:after { top: -6px; left: 7px; } .datetimepicker-dropdown-top-left:before { bottom: -7px; right: 6px; } .datetimepicker-dropdown-top-left:after { bottom: -6px; right: 7px; } .datetimepicker-dropdown-top-right:before { bottom: -7px; left: 6px; } .datetimepicker-dropdown-top-right:after { bottom: -6px; left: 7px; } .datetimepicker td, .datetimepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border: none; } .table-striped .datetimepicker table tr td, .table-striped .datetimepicker table tr th { background-color: transparent; } .datetimepicker table tr td.old, .datetimepicker table tr td.new { color: #999999; } .datetimepicker table tr td.disabled, .datetimepicker table tr td.disabled:hover { background: none; color: #999999; cursor: default; } .datetimepicker table tr td.today, .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today.disabled:hover { background-color: #fde19a; background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); background-image: linear-gradient(to bottom, #fdd49a, #fdf59a); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#fdd49a‘, endColorstr=‘#fdf59a‘, GradientType=0); border-color: #fdf59a #fdf59a #fbed50; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); } .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today:hover:hover, .datetimepicker table tr td.today.disabled:hover, .datetimepicker table tr td.today.disabled:hover:hover, .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today:hover.disabled, .datetimepicker table tr td.today.disabled.disabled, .datetimepicker table tr td.today.disabled:hover.disabled, .datetimepicker table tr td.today[disabled], .datetimepicker table tr td.today:hover[disabled], .datetimepicker table tr td.today.disabled[disabled], .datetimepicker table tr td.today.disabled:hover[disabled] { background-color: #fdf59a; } .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active { background-color: #fbf069 \9; } .datetimepicker table tr td.active, .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active.disabled:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(to bottom, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#0088cc‘, endColorstr=‘#0044cc‘, GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active:hover:hover, .datetimepicker table tr td.active.disabled:hover, .datetimepicker table tr td.active.disabled:hover:hover, .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active:hover.disabled, .datetimepicker table tr td.active.disabled.disabled, .datetimepicker table tr td.active.disabled:hover.disabled, .datetimepicker table tr td.active[disabled], .datetimepicker table tr td.active:hover[disabled], .datetimepicker table tr td.active.disabled[disabled], .datetimepicker table tr td.active.disabled:hover[disabled] { background-color: #0044cc; } .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active { background-color: #003399 \9; } .datetimepicker .datetimepicker-hours table tr td span.hour_am, .datetimepicker .datetimepicker-hours table tr td span.hour_pm { width: 14.6%; } .datetimepicker .datetimepicker-hours fieldset legend, .datetimepicker .datetimepicker-minutes fieldset legend { margin-bottom: inherit; line-height: 30px; } .datetimepicker table tr td span.disabled, .datetimepicker table tr td span.disabled:hover { background: none; color: #999999; cursor: default; } .datetimepicker table tr td span.active, .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active.disabled:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(to bottom, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=‘#0088cc‘, endColorstr=‘#0044cc‘, GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active:hover:hover, .datetimepicker table tr td span.active.disabled:hover, .datetimepicker table tr td span.active.disabled:hover:hover, .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active:hover.disabled, .datetimepicker table tr td span.active.disabled.disabled, .datetimepicker table tr td span.active.disabled:hover.disabled, .datetimepicker table tr td span.active[disabled], .datetimepicker table tr td span.active:hover[disabled], .datetimepicker table tr td span.active.disabled[disabled], .datetimepicker table tr td span.active.disabled:hover[disabled] { background-color: #0044cc; } .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active { background-color: #003399 \9; } .datetimepicker thead tr:first-child th, .datetimepicker tfoot tr:first-child th { cursor: pointer; } .datetimepicker thead tr:first-child th:hover, .datetimepicker tfoot tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i, .input-group.date .input-group-addon span { cursor: pointer; width: 14px; height: 14px; } .datepicker.dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; float: left; display: none; min-width: 160px; list-style: none; background-color: #fff; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.2); -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); -webkit-background-clip: padding-box; -moz-background-clip: padding; background-clip: padding-box; *border-right-width: 2px; *border-bottom-width: 2px; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; } .datepicker.dropdown-menu th, .datepicker.dropdown-menu td { padding: 4px 5px; } .datepicker .prev, .datepicker .next { font-style: normal; } .datepicker .prev:after { content: "«"; } .datepicker .next:after { content: "»"; }
jquery.js以及bootstrap.js自己去官网下载,这里就不复制了
/* ========================================================= * bootstrap-datetimepicker.js * ========================================================= * Copyright 2012 Stefan Petre * * Improvements by Andrew Rowls * Improvements by Sébasti
以上是关于在htm中bootstrap+datetimepicker怎么样设置默认时间的主要内容,如果未能解决你的问题,请参考以下文章
关于bootstrap时间控件datetimepicker的位置错乱问题