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

上一篇:也谈读书和书籍选择问题(C#)


下一篇:lesson - 4 Linux目录文件管理