js 获取当前url参数

2014-7-1 应用在某内网应用排序管理页面跳转:

 

function goSortManage() {
    var name = ‘TypeID‘;
    var TypeID = "0";
    var url = location.search; //获取url中"?"符后的字串
    var theRequest = new Object();
    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]] = unescape(strs[i].split("=")[1]);
        }
    }

    if (theRequest != null && theRequest[‘TypeID‘] != undefined) {

        TypeID = theRequest[‘TypeID‘];
    }
    

     var url = ‘/tabid/294/Default.aspx?f_ID=‘ + TypeID + "&columns=7";

   window.location.href = url;

   }

 

注意:

1: theRequest[‘TypeID‘] != undefined   而不是 theRequest[‘TypeID‘] != "undefined"

 

js 获取当前url参数,布布扣,bubuko.com

js 获取当前url参数

上一篇:php抽奖概率算法


下一篇:论asp.net out、ref、return