Js split using parameterized URL, it will separate parameters

Content of www.XXXX.com?content=123 url;

What is js content, wrapped in an init method.

init();
    function init(){
                var theRequest = new Object();
                var url = location.search;
                   if (url.indexOf("?") != -1) {
                     var str = url.substr(1);
                     strs = str.split("&");
                      for(var i = 0; i < strs.length; i ++) {
                        theRequest[strs[i].split("=") [ 0 ]] = (STRs [I] .split ( " = " ) [ . 1 ]); 
                      } 
                   } 
                   var CC = theRequest [ ' Content ' ]; // single quotes here as a tag or modify the url parameter name
                    
                   
    };

 

Guess you like

Origin www.cnblogs.com/wys-373/p/10979551.html