zoukankan      html  css  js  c++  java
  • Jquery相关总结

    1.(1) 判断checkbox是否选中  -----xxx.is(':checked')

       (2)设置checkbox选中或取消    xxx.prop("checked", true/false); 或者  xxx.attr("checked", true/false);  一个不可以使用另一个

    2.计算时间差

    function CalcTimeSpan(starttime, endtime) {
      var d1 = new Date(starttime);

      var d2 = new Date(endtime);
      var hour = ((d2 - d1) / 1000 / 60 / 60).toFixed(2);//得到小时数保留两位小数
      return hour;
    }

    3   jquery 处理mvc自带 json返回时间格式 /Date(12321312314)/的处理

    function ChangeDateFormat(cellval) {
    var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    return date.getFullYear() + "-" + month + "-" + currentDate;
    }

  • 相关阅读:
    POJ_1485_dp
    POJ_1376_bfs
    [noi1994]海盗
    [noi1755]Trie
    [luogu3733]八纵八横
    [noi1774]array
    [noi1773]function
    [noi1754]SA
    [noi1779]D
    [bzoj4873]寿司餐厅
  • 原文地址:https://www.cnblogs.com/zxking/p/8630281.html
Copyright © 2011-2022 走看看