function getQueryStringArgs() {
//取得查询字符串并去掉开头的问号
var qs = (location.search.length >0? location.search.substring(1) : ""); //保存数据的对象
var args= {}; //取得每一项
var items = qs.split("&");
var item = null,
name = null,
value = null; //逐个将每一项添加到args对象中
for (var i=0; i<items.length; i++) {
item = items[i].split("=");
name = decodeURIComponent(item[0]);//解码名称
vale = decodeURIComponent(item[1]);//解码值
args[name] = value;
} return args;
}

location查询字符串解析的更多相关文章

  1. 将查询字符串解析转换为泛型List的名值集合.

    ///<summary> ///将查询字符串解析转换为泛型List的名值集合. ///</summary> ///<param name="queryStrin ...

  2. parse_str() 函数把查询字符串解析到变量中。

    定义和用法 parse_str() 函数把查询字符串解析到变量中. 注释:如果未设置 array 参数,则由该函数设置的变量将覆盖已存在的同名变量. 注释:php.ini 文件中的 magic_quo ...

  3. parse_str() 函数把查询字符串解析到变量中。

    注释:如果未设置 array 参数,则由该函数设置的变量将覆盖已存在的同名变量. 注释:php.ini 文件中的 magic_quotes_gpc 设置影响该函数的输出.如果已启用,那么在 parse ...

  4. php的URL查询字符串解析函数

    URL查询字符串格式:Data[650][BLN]=40002307312&Data[650][Status]=電聯無人接聽. 解析这种数据使用函数:parse_str(). parse_st ...

  5. querystring 解析url 查询字符串

    对前端同学来说,经常要碰到一种比较麻烦的情况,那就是url查询字符串的解析问题.说起来也不难,就是比较麻烦. 具体来处理这种情况的时候,相信有一部分同学就是针对具体项目中的需要的字符去正则匹配一下,业 ...

  6. 使用Location对象查询字符串参数

    location是BOM中最有用的对象之一: 1.它提供了与当前窗口中加载的文档有关的信息: 2.他还提供了一些导航功能. location对象的属性有: hash, host, hostname, ...

  7. 《JS高级程序设计》笔记 —— 解析查询字符串

    今天在继续翻阅<JS高级程序设计>的时候,正好翻到location对象这一小节,其中有一部分就是讲的解析查询字符串.看到这个内容立马想到了做去哪儿秋招笔试题的时候有这么一道题. 去哪儿笔试 ...

  8. location对象查询字符串参数

    虽然location.search可以返回从问号到URL末尾的所有内容,但却没有办法逐个访问其中的每个查询字符串参数.为此,可以创建下面这样一个函数,用以解析查询字符串,然后返回包含所有参数的一个对象 ...

  9. 黑马旅游网 解析url查询字符串

    function getUrlParam(name) { let reg = new RegExp("(^|&)" + name + "=([^&]*)( ...

随机推荐

  1. jquery的一些select操作小记

    添加option $("#ID option").each(function(){ if($(this).val() == 111){ $(this).remove(); } }) ...

  2. 使用SharePoint 2010的母版页

    转:http://tanyanbo2.blog.163.com/blog/static/97339159201111591458902/ SharePoint 2010母版页所用的还是ASP.NET ...

  3. AngularJS with MVC4 CRUD

    CRUD using MVC Web API and AngularJS In this article I am going to demonstrate about how can we crea ...

  4. Parallel for loops in .NET C# z

    The start index: this is inclusive, i.e. this will be the first index value in the loop The end inde ...

  5. android studio 使用的一些注意,一些报错的解决方法(原创)

    NDK 编译无法通过 注意看 build.gradle 里面的 有些是 ndk-build windows 上用 ndk-build.cmd Summary: gradle calls ndk-bui ...

  6. HDU4614 Vases and Flowers 二分+线段树

    分析:感觉一看就是二分+线段树,没啥好想的,唯一注意,当开始摆花时,注意和最多能放的比大小 #include<iostream> #include<cmath> #includ ...

  7. codeforces 401D (数位DP)

    思路:很明显的数位dp,设dp[i][j] 表示选取数字的状态为i,模m等于j的数的个数,那么最后的答案就是dp[(1<<n)-1][0].状态转移方程就是,dp[i|(1<< ...

  8. MFC常用类

    CString CStringT 操作可变长度字符串的模板类CStringT有三个实例:CString.CStringA和CStringW,它们分别提供对TCHAR.char和wchar_t字符类型的 ...

  9. extern "C"的用法解析(转)

    原文链接:http://www.cnblogs.com/rollenholt/archive/2012/03/20/2409046.html   1.引言 C++语言的创建初衷是“a better C ...

  10. 2015北京网络赛B题 Mission Impossible 6

    借用大牛的一张图片:模拟 #include<cstdio> #include<cmath> #include<cstring> #include<algori ...