Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02、获取url所带参数并组成数组对象 #2

Open
Peter-Success opened this issue May 25, 2018 · 0 comments
Open

02、获取url所带参数并组成数组对象 #2

Peter-Success opened this issue May 25, 2018 · 0 comments

Comments

@Peter-Success
Copy link
Owner

Peter-Success commented May 25, 2018

           var str = window.location.search.substr(1),
           num = 0,
           arr1 = [],
           arr2=str.split("&");
           for(var i=0;i < arr2.length;i++){
               var num=arr2[i].indexOf("="),
                     obj = {};
               if(num>0){
                   obj.key = arr2[i].substr(0,num);
                   obj.value = arr2[i].substr(num+1);
                   arr1.push(obj)
                };
            };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant