jquery datepicker只显示年和月
<html xmlns="http://www.w3.org/1999/xhtml">
<head >
<title></title>
<link type="text/css" href="../../Scripts/jquery-ui-1.8.1.custom.css" rel="Stylesheet" />
<script src="../../Scripts/jquery-1.4.4.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.core.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.datePicker.js" type="text/javascript"></script>
<script src="../../Scripts/ui.datepicker-zh-CN.js" type="text/javascript"></script>//中文汉化
<script src="../../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('#Datepicker').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yy-MM',
showButtonPanel: true,
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month option:selected").val();//得到选中的月份值
var year = $("#ui-datepicker-div .ui-datepicker-year option:selected").val();//得到选中的年份值
$('#Datepicker').val(year+'-'+(parseInt(month)+1));//给input赋值,其中要对月值加1才是实际的月份
}
});
});
</script>
<style type="text/css">
//隐藏日的显示div
.ui-datepicker-calendar {
display: none;
}
</style>
</head>
<body>
<form id="form1" >
Date: <input id="Datepicker" type="text"/>
</form>
</body>
</html>
http://hi.baidu.com/ly810916/item/4a611870661e613e70442353
jquery datepicker只显示年和月的更多相关文章
- WPF DatePicker只显示年和月 修改:可以只显示年
最近的项目,查询时只需要年和月,不需要日,因此需要对原有的DatePicker进行修改,查询了网上的内容,最终从一篇帖子里看到了添加附加属性的方法,地址是http://stackoverflow.co ...
- jquery datepicker 只显示年月
首先修改默认日期赋值 <script type="text/javascript"> $(function(){ $('#searchDate').datepicker ...
- 关于datepicker只显示年、月、日的设置
关键时侯,还得看官方文档.花了半个多小时,找了网上一大堆答复,然后一一验证,90%没有能解决问题. 先给出官方文档的URL: http://bootstrap-datepicker.readthedo ...
- bootstrap-datepicker控件中文 ,只显示年和只显示月份
插件下载地址 https://github.com/uxsolutions/bootstrap-datepicker html <link href="css/bootstrap-da ...
- 自定义一个只显示年月的DatePicker(UIDatePicker无法实现年月显示)
HooDatePicker 介绍(introduction) ==================================================项目需要一个DatePicker,只显 ...
- jquery easyUI 日期格式化,DateBox只显示年
jquery easyUI 日期格式化,DateBox只显示年 >>>>>>>>>>>>>>>>> ...
- 关于datetimepicker只显示年、月、日的设置
如下是只显示月的sample code: <link rel="stylesheet" href="css/datetimepicker/bootstrap-dat ...
- 日期选择器:jquery datepicker的使用
helloweba.com 作者:月光光 时间:2012-04-08 21:05 标签: jquery datepicker jquery ui 在jquery ui中,提供了一个非常实用 ...
- 推荐三款日期选择插件(My97DatePicker+jquery.datepicker+Mobiscroll)
1.My97DatePicker 纯原生JS,专注于PC端,支持IE6+:页面上只需要引入WdatePicker.js文件,但是My97DatePicker整个目录是一个整体,最好不要破坏里面的目录结 ...
随机推荐
- Python3求英文文档中每个单词出现的次数并排序
[本文出自天外归云的博客园] 题目要求: 1.统计英文文档中每个单词出现的次数. 2.统计结果先按次数降序排序,再按单词首字母降序排序. 3.需要考虑大文件的读取. 我的解法如下: import ch ...
- virtualbox问题收集
The VM session was closed before any attempt to power it on. 返回 代码:E_FAIL (0x80004005)组件:SessionMach ...
- 适配器模式,装饰模式,代理模式异同<转>
节前把3个设计模式的学习心得分享了一下,分别是适配器模式,装饰模式,代理模式. 但是似乎越写越有些迷糊,这三种模式都有着一些大同小异的地方,总是有些搞不清. 今天再重新学习下,把学习心得分享给大家一下 ...
- boot cd_rom struct
资料: 1.introduction_to_iso9660.pdf 2.boot-cdrom.pdf Normal ISO9600:offset: 16*2048[0x8000] The Primar ...
- H2O中的随机森林算法介绍及其项目实战(python实现)
H2O中的随机森林算法介绍及其项目实战(python实现) 包的引入:from h2o.estimators.random_forest import H2ORandomForestEstimator ...
- 【oneday_onepage】——Microsoft adds a wing, more closets to the homes of SharePoint Online tenants
To prevent SharePoint Online customers from feeling boxed in, Microsoft wants to improve the way the ...
- python转义符的使用
写了几行代码不能用.========有个需要的注意的就是在pycharm中看见蓝色字体要注意了一定是关键字什么,这个以后要注意. import os # g = os.walk("D:\aa ...
- scrapy爬虫出现Forbidden by robots.txt
scrapy爬虫出现Forbidden by robots.txt
- Mybatis if标签判断大小
1.if标签语法 <select...> SQL语句1 <if test="条件表达式"> SQL语句2 </if> </select&g ...
- JAVA三大框架SSH和MVC
Java—SSH(MVC) JAVA三大框架的各自作用 hibernate是底层基于jdbc的orm(对象关系映射)持久化框架,即:表与类的映射,字段与属性的映射,记录与对象的映射 数据库模型 ...