zoukankan      html  css  js  c++  java
  • 常用JS代码整理

      1: function request(paras) {   
      2:     var url = location.href;   
      3:     var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");   
      4:     var paraObj = {};   
      5:     for (i = 0; j = paraString[i]; i++) {   
      6:         paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);   
      7:     }   
      8:     var returnValue = paraObj[paras.toLowerCase()];   
      9:     if (typeof (returnValue) == "undefined") {   
     10:         return "";   
     11:     } else {   
     12:         return returnValue;   
     13:     }   
     14: }  
      1: //JS 列出两个日期之间的所有天
      2: function show(value1, value2) {   
      3:     var getDate = function (str) {   
      4:         var tempDate = new Date();   
      5:         var list = str.split("-");   
      6:         tempDate.setFullYear(list[0]);   
      7:         tempDate.setMonth(list[1] - 1);   
      8:         tempDate.setDate(list[2]);   
      9:         return tempDate;   
     10:     }   
     11:     var date1 = getDate(value1);   
     12:     var date2 = getDate(value2);   
     13:     if (date1 > date2) {   
     14:         var tempDate = date1;   
     15:         date1 = date2;   
     16:         date2 = tempDate;   
     17:     } date1.setDate(date1.getDate() + 1);   
     18:     while (!(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() == date2.getDate())) {   
     19:         document.write("<div style='display:block'>" + date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate() + "</div>");   
     20:         date1.setDate(date1.getDate() + 1);   
     21:     }   
     22: }  
  • 相关阅读:
    EasyUI treegrid 加载checked
    html 文字垂直居中
    SQLSERVER 2008 查询数据字段名类型
    EasyUI TreeJson
    win7 网站发布备注
    LVS Nginx HAProxy 优缺点
    快速安装laravel和依赖
    Whoops, looks like something went wrong
    View.findViewById()和Activity.findViewById()区别
    ListView下拉刷新,上拉自动加载更多
  • 原文地址:https://www.cnblogs.com/twzy/p/5123976.html
Copyright © 2011-2022 走看看