jhyimu2005 发表于 2013-2-6 08:41:37

jsp 日历

效果图在附件中



使用后感觉还不错,拿出来大家共享一下

其使用方法为

在相应的jsp页面中引入date_input.css和jquery.date_input.js文件

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/date_input.css">

<script type="text/javascript" src="${pageContext.request.contextPath}/js/datePicker/jquery.date_input.js"></script>



<script type="text/javascript">
       <!To be formate date">
      $.extend(DateInput.DEFAULT_OPTS, {
   stringToDate: function(string) {
      var matches;
      if (matches = string.match(/^(\d{4,4})-(\d{2,2})-(\d{2,2})$/)) {
      return new Date(matches, matches - 1, matches);
      } else {
      return null;
      };
   },
   dateToString: function(date) {
      var month = (date.getMonth() + 1).toString();
      var dom = date.getDate().toString();
      if (month.length == 1) month = "0" + month;
      if (dom.length == 1) dom = "0" + dom;
      return date.getFullYear() + "-" + month + "-" + dom;
    }
});
      $($.date_input.initialize);
    </script>





<input type="text" class="date_input" name="startDateStr" value= "${meeting.startDate}"/>
页: [1]
查看完整版本: jsp 日历