解析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";
 } ​

 

posted @ 2016-10-18 19:54  suruozhong  阅读(368)  评论(0编辑  收藏  举报