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

    运行效果图:

  • 相关阅读:
    Webpack安装及基础配置
    相机拍到了光源的灯珠图像
    面向对象特殊用法
    面向对象初始
    内置函数和必须的模块
    模块基本模式
    函数三
    函数二
    装饰器
    函数初识
  • 原文地址:https://www.cnblogs.com/dabexiong/p/4964077.html
Copyright © 2011-2022 走看看