解析window.open链接的参数

var str = window.location.search.substr(1); 
 var arr = new Array();
 arr = str.split("&"); 
 if(arr.length!=0){
 for(var i=0; i<arr.length; i++){
 if(arr[i].indexOf('pagetype')>-1){
 var pagetype = arr[i].substring(9);
 if(pagetype!=null && pagetype.trim()!=""){
 currPage = pagetype;
   }else{
    currPage = "costmarkout";
 }
    break;
 }else{
    currPage = "costmarkout";
 }
    }
 }else{
    currPage = "costmarkout";
 } ​
原文地址:https://www.cnblogs.com/suruozhong/p/5974694.html