Add/Update new parameters to the current URL

Source: Internet
Author: User

    /** * Add/Update new parameters to current URL * @param a parameter * @param b value * @returns {string} new parameter * @constructor*/    functionGeturlparms (A, b) {varargs=NewObject (); varQuery=location.search.substring (1);//Get query string      varPairs=query.split ("&");//Break at comma      varret = ""; varisOK = 0 ;  for(vari=0;i<pairs.length;i++)   {        varPos=pairs[i].indexof (' = ');//Find Name=value        if(Pos==-1)Continue;//If you don't find it, skip it.        varArgname=pairs[i].substring (0,pos);//Extract Name        varValue=pairs[i].substring (pos+1);//Extract ValueArgs[argname]=unescape (value);//Save As Property        //alert (argname+ "" +args[argname]);        if("page" = =argname) {ret+ = argname+ "=1" + "&"; Continue ; }        if(a!=argname) {ret+ = argname+ "=" +args[argname]+ "&"; }      }      if(isok==0) {ret+ = + "=" +b+ "&"; }      if(ret== "") ret = "&"; returnret; }

Add/Update new parameters to the current URL

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.