• commonJs


    //获取参数 修复中文参数的获取 
     1 function GetRequest() {
     2     var url = location.search; //获取url中"?"符后的字串
     3     var theRequest = new Object();
     4     if (url.indexOf("?") != -1) {
     5         var str = url.substr(1);
     6         strs = str.split("&");
     7         for(var i = 0; i < strs.length; i ++) {
     8             theRequest[strs[i].split("=")[0]]=decodeURIComponent(strs[i].split("=")[1]);
     9         }
    10     }
    11     return theRequest;
    12 }

    获取参数  

     1 //获取参数  不推荐使用,获取的参数如果有中文将出现乱码
     2 function GetRequest() {
     3     var url = location.search; //获取url中"?"符后的字串
     4     var theRequest = new Object();
     5     if (url.indexOf("?") != -1) {
     6         var str = url.substr(1);
     7         strs = str.split("&");
     8         for(var i = 0; i < strs.length; i ++) {
     9             theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
    10         }
    11     }
    12     return theRequest;
    13 }
    返回值为undefined null 检测
    1  function undefinedData(v){
    2           if(v=='undefined'||v==null){
    3               return ' ';
    4           }else{
    5               return v;
    6           }
    7     }
  • 相关阅读:
    审核系统
    ehcache 缓存
    tomcat 内存设置
    html5 开发 跨平台 桌面应用
    service thread 结合使用
    html5桌面应用
    鼠标 事件
    服务器 判断 客户端 文件下载
    使用github管理Eclipse分布式项目开发
    uub代码
  • 原文地址:https://www.cnblogs.com/s-xl/p/10397206.html
Copyright © 2020-2023  润新知