`
这些年
  • 浏览: 388700 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

bootstrap

    博客分类:
  • js
 
阅读更多

学习网站:http://www.bootcss.com/

 

1:日期插件(bootstrap-datepicker)

     1):导入js及css

            下载:http://aymkdn.github.io/Datepicker-for-Bootstrap/

      2):创建mod及应用控件

           

$(document).ready(function() {
	$('#day').datepicker({
		"format":'yyyy-mm-dd'
	});
});

<input   name="day" id="day"  type="text" />

 2:别一个可以同时处理日期时间的例子

       1):下载控件

             url:http://www.bootcss.com/p/bootstrap-datetimepicker/

       2 ):修改其sample in bootstrap v3下的index.html

             

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="../css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
</head>

<body>
<div class="container">
    <form action="" class="form-horizontal"  role="form">
        <fieldset>
            <legend>Test</legend>
            <div class="form-group">
                <label for="dtp_input1" class="col-md-2 control-label">DateTime Picking</label>
                <div class="input-group date form_datetime col-md-5" data-date="1979-09-16T05:25:07Z" data-date-format="dd MM yyyy - HH:ii p" data-link-field="dtp_input1">
                    <input class="form-control" size="16" type="text" value="" readonly>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
					<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
                </div>
				<input type="hidden" id="dtp_input1" value="" /><br/>
            </div>
			<div class="form-group">
                <label for="dtp_input2" class="col-md-2 control-label">Date Picking</label>
                <div class="input-group date form_date col-md-5" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                    <input class="form-control" size="16" type="text" value="" readonly>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
					<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
				<input type="hidden" id="dtp_input2" value="" /><br/>
            </div>
			<div class="form-group">
                <label for="dtp_input3" class="col-md-2 control-label">Time Picking</label>
                <div class="input-group date form_time col-md-5" data-date="" data-date-format="hh:ii" data-link-field="dtp_input3" data-link-format="hh:ii">
                    <input class="form-control" size="16" type="text" value="" readonly>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
					<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
                </div>
				<input type="hidden" id="dtp_input3" value="" /><br/>
            </div>
        </fieldset>
    </form>
</div>

<script type="text/javascript" src="./jquery/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="./bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="../js/locales/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>  //国际化文件,须要设置编码
<script  type="text/javascript">
Date.prototype.format = function (format) {  //日期格式化
    /*  
     * eg:format="YYYY-MM-dd hh:mm:ss";  
     */   
    var  o = {  
        "M+"  : this .getMonth() + 1,  // month   
        "d+"  : this .getDate(),  // day   
        "h+"  : this .getHours(),  // hour   
        "m+"  : this .getMinutes(),  // minute   
        "s+"  : this .getSeconds(),  // second   
        "q+"  :Math.floor(( this .getMonth() + 3) / 3),  // quarter   
        "S"  : this .getMilliseconds()  
    // millisecond   
    }  
  
    if  (/(y+)/.test(format)) {  
        format = format.replace(RegExp.$1, (this .getFullYear() +  "" )  
                .substr(4 - RegExp.$1.length));  
    }  
  
    for  (  var  k  in  o) {  
        if  ( new  RegExp( "("  + k +  ")" ).test(format)) {  
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]  
                    : ("00"  + o[k]).substr(( ""  + o[k]).length));  
        }  
    }  
    return  format;  
}  
</script>
<script type="text/javascript">
    $('.form_datetime').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		forceParse: 0,
        showMeridian: 1
    });
	$('.form_date').datetimepicker({
		format: 'yyyy-mm-dd',
        language:  'fr', //国际化(语言)
        weekStart: 1,    //一周从哪一天开始。0(星期日)到6(星期六)
        todayBtn:  1,    //是否显示当前日期按钮
		autoclose: 1,    //当选择一个日期之后是否立即关闭此日期时间选择器。
		todayHighlight: 1,   //如果为true, 高亮当前日期
		startView: 2,
		minView: 2,
		forceParse: 0     //当选择器关闭的时候,是否强制解析输入框中的值
    });
	var date1 = new  Date().format("yyyy-MM-dd");
	alert(date1)
	$('.form_date').datetimepicker('setEndDate',date1);//限制其结束时间
	$('.form_time').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 1,
		minView: 0,
		maxView: 1,
		forceParse: 0
    });
</script>

</body>
</html>

       3)修改国际化文件:js\locales\bootstrap-datetimepicker.fr.js

   

/**
 * French translation for bootstrap-datetimepicker
 * Nico Mollet <nico.mollet@gmail.com>
 */
;(function($){
	$.fn.datetimepicker.dates['fr'] = {
		days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
        daysShort: ["日", "一", "二", "三", "四", "五", "六", "日"],
        daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
        months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        today: "今天",
		suffix: [],
		meridiem: ["上午", "下午"],
		weekStart: 1,
		format: "yyyy-mm-dd"
	};
}(jQuery));

 

分享到:
评论

相关推荐

    bootstrap bootstrap-3.3.7

    这个里面 包含整个bootstrap源程序 你所需要的都在了、里面.Bootstrap,来自 Twitter,是目前最受欢迎的前端框架。Bootstrap 是基于 HTML、CSS、JAVASCRIPT 的,它简洁灵活,使得 Web 开发更加快捷。 本教程将向您...

    Bootstrap 图标库下载

    Bootstrap Icons:Bootstrap 有史以来第一次拥有自己的图标库,并且是专门为 Bootstrap 的组件和文档定制开发的。 Bootstrap Icons 的设计初衷是与 Bootstrap 组件配合使用,从表单到导航组件等。Bootstrap Icons ...

    bootstrap-4.5.0.zip

    Bootstrap (Web框架 可用) Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML、CSS、JavaScript 开发的简洁、直观、强悍的前端开发框架,使得 Web 开发更加快捷。Bootstrap提供了优雅的...

    Bootstrap期末课程设计

    资源名称:Bootstrap期末课程设计 内容使用语言:HTML5+css3+js+bootstrap框架 使用/学习场景:完成整个学期成果,了解框架的好处 应用场景:对于使用框架对于完成一个网页的实现更加容易 特点:加深对前端语言的...

    bootstrap-table后端分页功能完整实例

    本文实例讲述了bootstrap-table后端分页功能。分享给大家供大家参考,具体如下: 使用bootstrap-table实现后台分页 插件资源点击此处本站下载。 引用以下css &lt;link rel="stylesheet" href="../plugins/...

    bootstrap-editable.zip

    可编辑bootstrap-table及相关组件:bootstrap3、bootstrap-table相关、bootstrap-table-editable.js、bootstrap-editable.js、bootstrap-editable.css; 配合起来,可以实现可编辑bootstrap-table列表。代码实现: ...

    bootstrap实现登录页面

    实现静态的登录页面,借助于bootstrap框架。Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML、CSS、JavaScript 开发的简洁、直观、强悍的前端开发框架,使得 Web 开发更加快捷。 ...

    Bootstrap.By.Example.1785288

    Master Bootstrap 4's frontend framework and build your websites faster than ever before About This Book Become an expert in Bootstrap framework, and speed up front-end development and prototyping ...

    Bootstrap HTML5 Responsive Templates (Bootstrap模版24种)

    (Bootstrap模版24种) Agency.zip andia-agency.zip bolt.zip bootbusiness.zip brushed.zip business-casual.zip codester-free-responsive-bootstrap-template.zip essentia.zip flatty.zip flat_theme.zip ...

    Bootstrap5 图标库 bootstrap-icons

    Bootstrap5 图标库 bootstrap-icons

    bootstrap-table 分页Demo

    bootstrap-table后端分页的参数设置Demo。 bootstrap-table是一款非常有名的开源表格插件,在很多项目中广泛的应用。Bootstrap-table插件提供了非常丰富的属性设置,可以实现查询、分页、排序、复选框、设置显示列、...

    全面解析多种Bootstrap图片轮播效果

    分享了三种Bootstrap图片轮播效果,相信总有一款你满意的! 第一种效果:Bootstrap简单轮播 &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Bootstrap 实例 - 简单的轮播(Carousel)插件&lt;/title...

    swagger-bootstrap-ui-1.9.6-API文档-中文版.zip

    赠送jar包:swagger-bootstrap-ui-1.9.6.jar; 赠送原API文档:swagger-bootstrap-ui-1.9.6-javadoc.jar; 赠送源代码:swagger-bootstrap-ui-1.9.6-sources.jar; 赠送Maven依赖信息文件:swagger-bootstrap-ui-...

    基于bootstrap-table 实现 右侧列固定

    基于bootstrap-table 实现 右侧列固定,也可以针对左侧列固定,针对操作列使用起来非常方便,引用jquery、bootstrap-table-fixed 样式和js文件后,可以随意设置,灵活。 fixedColumns: true,//fixedtNumber:2, //...

    Bootstrap 3 综合实战项目教程,Web前端响应式开发项目实战视频教程带源码资源

    Bootstrap 3 综合实战项目教程,Web前端响应式开发项目实战视频教程带源码资源Bootstrap 3 综合实战项目教程,Web前端响应式开发项目实战视频教程带源码资源Bootstrap 3 综合实战项目教程,Web前端响应式开发项目...

    两套bootstrap5框架后台管理模板 - Amdash

    Amdash是基于Bootstrap5框架实现的后台管理模板。它有多个仪表盘样式,工作在所有主要浏览器、桌面和所有智能手机设备上。非常易于定制和开发人员友好的HTML5模板。集合与最新jQuery UI组件和bootstrap插件。它可以...

    bootstrapValidator.js验证在bootstrap4.0使用

    1.bootstrap使用4.0 2.customValidator.css Bootstrap v4.0.0-beta (https://getbootstrap.com) jQuery v3.2.1

    开发工具 dataTables.bootstrap.min

    开发工具 dataTables.bootstrap.min开发工具 dataTables.bootstrap.min开发工具 dataTables.bootstrap.min开发工具 dataTables.bootstrap.min开发工具 dataTables.bootstrap.min开发工具 dataTables.bootstrap.min...

    Bootstrap Table 搜索框和查询功能

    知识点bootstrapTable 刷新和查询配置 2.提升js代码性能 1.减少全局变量声明 2.缓存dom节点查找结果 3.局部变量缓存全局变量  /** * @param col bootstrapTable列表生成配置对象 */ var searchValue ={};//查询...

Global site tag (gtag.js) - Google Analytics