html5 – 在Firefox中的html5 datepicker

有什么办法可以设置在Firefox 5中启用firefox(版本21)中的日期戳。我不想使用基于jQuery的日期戳,因为javascript将被禁用在浏览器的网站将被使用。 datepicker适用于Chrome。

那么如果不支持html 5 datepicker,那么如何在没有jquery的情况下添加一个datepicker?

解决方法

jQuery UI有一个datepicker小部件,您可以有条件地加载浏览器没有内置的。捕获是,即使是 you only select the datepicker widget in a custom jQuery UI build,它仍然是一个重要的下载。

我最喜欢的解决方案是使用Modernizr附带的yepnope来有条件地加载jQuery UI CSS和JS文件,只有在datepicker需要的时候。通过结合optimized build of Modernizra datepicker-only jQuery UI build,它为您提供了所有可能的浏览器的最小的下载。

yepnope({ /* included with Modernizr */
  test : Modernizr.inputtypes.date,nope : {
    'css': '/path-to-your-css/jquery-ui-1.10.3.custom.min.css','js': '/path-to-your-js/jquery-ui-1.10.3.datepicker.min.js'
  },callback: { // executed once files are loaded
    'js': function() { $('input[type=date]').datepicker({dateFormat: "yy-mm-dd"}); } // default HTML5 format
  }
});

相关文章

HTML5和CSS3实现3D展示商品信息的代码
利用HTML5中的Canvas绘制笑脸的代码
Html5剪切板功能的实现
如何通过HTML5触摸事件实现移动端简易进度条
Html5移动端获奖无缝滚动动画实现
关于HTML5和CSS3实现机器猫的代码