//注意url中要含?
 function getParameterByName(name, url) {
            if (!url) {
                url = window.location.href;
            }
            name = name.replace(/[\[\]]/g, "\\$&");
            var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, " "));
        }
调用:getParameterByName("userID","?userID=JeoOrCXxyiOFxbYaGL40kw==&userPwd=sdFo2ziUw8HyLRKd4i6GAQ==&userName=高聪");
得到:userID值  var parseQuery = function (query) {
            var reg = /([^=&\s]+)[=\s]*([^&\s]*)/g;
            var obj = {};
            while (reg.exec(query)) {
                obj[RegExp.$1] = RegExp.$2;
            }
            return obj;
        }
调用:
parseQuery("userID=JeoOrCXxyiOFxbYaGL40kw==&userPwd=sdFo2ziUw8HyLRKd4i6GAQ==&userName=高聪")
得到
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+MAAACTCAIAAABqLF/bAAAOKElEQVR4nO3dPU7rTBsGYC8oEkJiL6lcZSMpaFKwjDRUaVhDGspIn8QmUiIhYL7CfzP2OPy8h5MJ57pEARN7xvELem8/eexTBQAAoDzVuQ8AAADIkNQBAKBE1f8AAIDyqKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDwF+3q8PVJhw2oarPfSicm18G5l1KUn+6u6k6N3dP8Y/d2LkPEQA+ZxeqOoRDuLoKh3MfC71NfY7/HH4ZOOVSknoITVpvE3n0bfejtA7AZajrEHK5sK5C1X1dbb446SFcdfvuPjyAaKFdCLs6VFVb0G1eqj+cYuYANofxSHxI7ULR12YmnO7qUE2Sax2dmc3VR2cpWr15O+3qM4H4sBm/1J6lbrDZ/Rsn5rS5XwYIIfxsUh/F6YdVVa0e+m877VA01u3zsKpu7p6a8dXDqaTe799NBgAX6RCuvtUCUfepd/dBE0UdBfHNVbvXrh52/05M//Qh1XEa3p2K2nUuUg+Dh1CfvJiJV+9X2VzNRu3NJllxczXk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/Emv3fzN0n9aYjYD6sucj+shvTdZPT4h2ba7LoAcCbZXD43IqnDb3eGpD4abl/KbJiOJvv3pfRptM5eEKQ/9EeQXxcAzuSTNfX4G0kdfq9z1NT7JpTuxbR7pW9PmUnq/QtPo06YUQPMx0l9Zl0AKNi0++V0sgcu1nn61EMa1zNV9naHfFJvM3qf1B9W4/b0zyd1zekAlOCTD34JM096EdDhNzpbUk82yfedzCf15rXV6qarvUd7f7H7RRUdgBKcjtofJvUw0wwDXLIf/XuOo/pwe2h7E2k/2oXtOEmvpl3k+Zr8uPG9Gf5sUs+vCwB/XZy/TzxDPUSJfPT4l9mnqgOX6of/mOPnIo6e6TJ+MuJ09GRST1L2sMzN3d0Xaur5dQHgrzvd0zLN8SGN7NmpgAvnjxkACvD5mnq8i2o6/Gr+pAGgACdC9twTXUbVdw9+gV/HnzQAAJRIUgcAgBJJ6gAAUCJJHQAASiSpAwBAiar/AQAA5VFTBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoESSOgAAlEhSBwCAEknqAABQIkkdAABKJKkDAECJJHUAACiRpA4AACWS1AEAoET/B5Nvlbclap1UAAAAAElFTkSuQmCC" alt="" />
 
 
 

js 把url参数转对象的更多相关文章

  1. JS解析URL参数为对象

    曲不离口,拳不离手 JS小编程练习之一:解析URL参数为对象 url:http://www.baidu.com/we/index.html?id=098&aaa=123&ccc=456 ...

  2. js获取url参数的方法

    js获取url参数的方法有很多. 1.正则分析 function getQueryString(name) { var reg = new RegExp("(^|&)" + ...

  3. get方法与post方法的区别与js获取url参数的方式

    1.get方法与post方法的区别: 区别一:get重点在从服务器上获取资源,post重点在向服务器发送数据:区别二:get传输数据是通过URL请求,以field(字段)= value的形式,置于UR ...

  4. js获取url参数,操作url参数

    function getParam(key) { var tmp = location.search; tmp = decodeURIComponent(tmp); var index = tmp.i ...

  5. js javascript 获取url,获得当前页面的url,静态html文件js读取url参数

    获得当前页面的url window.location.href 静态html文件js读取url参数 location.search; //获取url中"?"符后的字串 下边为转载的 ...

  6. 【js操作url参数】获取指定url参数值、取指定url参数并转为json对象

    获取指定url参数值 /* 获取某url中的某参数值 调用:GetUrlQueryString("[url地址]","[参数名]"); */ function ...

  7. js修改url参数,无刷新更换页面url

    一.js修改地址栏URL参数 function changeURLPar(destiny, par, par_value) { var pattern = par + '=([^&]*)'; ...

  8. 用js 获取url 参数 页面跳转 ? 后的参数

    记得之前在原来的公司写过这个东西,但是还是忘记怎么接住参数了,只知道怎么把id传过去! 问了身边的大佬 他首先推荐了我一个链接是别人写好的方法 附上链接地址:http://blog.csdn.net/ ...

  9. js截取url参数

    举例说明,比如http://localhost:2019/blog/getCommentListInfo?postId=1如何获取postId=1这个参数值呢?很简单通过下面代码即可获取,如: win ...

随机推荐

  1. adb unknown host service 这个问题的解决,转载

    一直没搞明白这个问题咋出现的,但今天看到一个方法,搞定了!原来是豌豆荚占用了 5037 端口导致. 参见原文章:一个豌豆荚引发的血案——关于ADB server didn't ACK的问题 简单来讲, ...

  2. R in a nutshell(连载)

    data(cars)dim(cars)names(cars)summary(cars)plot(cars, xlab = "Speed (mph)", ylab = "S ...

  3. Balance - 七夕悠然

    想争取一个月至少一篇博客的,还是没搭上七月的末班车.两个小妹妹来上海看我了,工作上又有点儿忙,充分利用所有时间了,还是没有挪出时间来写东西,貌似写东西也要时机一样,需要在可以静静思考的时候,再加上有淡 ...

  4. 【分块打表】bzoj1662 [Usaco2006 Nov]Round Numbers 圆环数

    #include<cstdio> using namespace std; #define BN 380000 const int table[]={0,185815,378154,561 ...

  5. php压缩文件

    $filename = './qrcode.zip'; // 最终生成的文件名(含路径) //生成文件 $zip = new ZipArchive (); // 使用本类,linux需开启zlib,w ...

  6. MIPS ABI n32意味着什么?

    ABI是应用程序二进制接口的简称,用于标识处理器的工作模式及规范目标文件的编码格式. MIPS指令集架构自MIPS3起正式支持64位工作模式,故编码可以遵从o32(o意思是old).n32(n意思是n ...

  7. 使用<c:if>标签处理页面数据

    使用${feeList.feeType}来取值的时候,因为定义的是数值,刚好看到<c:if>标签的使用,套用代码如下 <td> <c:if test="${fe ...

  8. windows 录音程序(一)

    (一)概述 1.依赖条件:winmm.lib 2.步骤: (1)打开设备 -----  waveInOpen(打开一个音频输入设备): (2)开始录音 ----- waveInStart开始录音: ( ...

  9. VS2012下配置OpenCV2.4.5

    最近在折腾了一下VS2012的OpenCVS2.4.5配置,同VS2010下基本相同,做个简单的记录,以备日后查阅. 1. 安装OpenCV 从OpenCV官网:http://opencv.org/下 ...

  10. C++内存对齐的理解

    程序编译器对结构的存储的特殊处理确实提高CPU存储变量的速度,但是有时候也带来了一些麻烦,我们也屏蔽掉变量默认的对齐方式,自己可以设定变量的对齐方式. 编译器中提供了#pragma pack(n)来设 ...