JS Get URL value

Source: Internet
Author: User

Gets the Address bar parameter array function geturlparams () {var search = Window.location.search;        Write data dictionary var tmparray = search.substr (1, search.length). Split ("&");        var paramsarray = new Array;    if (Tmparray! = null) {for (var i = 0; i < tmparray.length; i++) {var reg =/[=|^==]/;                Split with =, but does not include = = var Set1 = tmparray[i].replace (Reg, ' & ');                var tmpStr2 = set1.split (' & ');                var array = new Array;                Array[tmpstr2[0]] = tmpstr2[1];            Paramsarray.push (array);    }}//returns the parameter array to return paramsarray;        }//Get parameter value according to parameter name function GetParamValue (name) {var paramsarray = Geturlparams (); if (Paramsarray! = null) {for (var i = 0; i < paramsarray.length; i++) {for (Var j in para          Msarray[i]) {if (j = = name) {return paramsarray[i][j];           }}}} return null;   }


Original address: http://blog.csdn.net/u013176520/article/details/41080307

JS Get URL value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.