zoukankan      html  css  js  c++  java
  • js 方法总结

      1.   格式化时间
    function format(str,fmt) { var usedDate = new Date(usedDay); var o = { "M+": usedDate.getMonth() + 1, //月份 "d+": usedDate.getDate(), // "h+": usedDate.getHours(), //小时 "m+": usedDate.getMinutes(), // "s+": usedDate.getSeconds(), // "q+": Math.floor((usedDate.getMonth() + 3) / 3), //季度 "S": usedDate.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (usedDate.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } var pattern = "yyyy-MM-dd"; var usedDay = 1454112000000; usedDate=format(usedDay,pattern);

    2.  

    var dialog = {
        title:'hi',
        show: function(){
            console.log(this.title);
        }
    }
    
    setTimeout(function(){
        dialog.show();
    },5000)
  • 相关阅读:
    phpcms相关
    php文件缓存
    js 、jq强化复习
    框架替换主页
    羽恒梦工厂所有后台的操作页面
    羽恒梦工厂个人中心
    羽恒梦工厂详情页
    待查的问题
    ASP.NET中的常用快捷键
    快速排序
  • 原文地址:https://www.cnblogs.com/redhat0019/p/9396533.html
Copyright © 2011-2022 走看看