zoukankan      html  css  js  c++  java
  • EasyUI篇の日期控件

    页面代码:

    1 <input type="text" id='astartTime' class="easyui-datebox" style=" 150px;" />
    View Code

    JS代码:

     1 <script type="text/javascript">
     2         $(function () {
     3             $("#astartTime").datebox({
     4                 onSelect: function (date) {   //选择日期
     5                     $("#astartTime ").val(date);
     6                     alert(date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日");
     7                 }
     8             });
     9         })
    10         window.onload = function () {
    11             $('#astartTime').datebox('setValue', formatterDate(new Date()));//设置日期初始日期为当前日期
    12         }
    13         formatterDate = function (date) {
    14             var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
    15             var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1);
    16             return date.getFullYear() + '-' + month + '-' + day;
    17         };
    18     </script>
    View Code

    运行效果图:

  • 相关阅读:
    12.Scala- 注解
    11.Scala-特质
    10.Scala-继承
    9.Scala- 包和引入
    8.Scala-对象
    7.Scala-类
    6.Scala-高阶函数
    5.Scala-匹配模式
    4.Scala-数据结构
    Ruby on Rails Tutorial 第四章 Rails背后的Ruby 之 类
  • 原文地址:https://www.cnblogs.com/dabexiong/p/4964077.html
Copyright © 2011-2022 走看看