JavaScript 获取页面参数

//获取页面参数
function getQueryString(param) {
    var query = window.location.search;
    var iLen = param.length;
    var iStart = query.indexOf(param);
    if (iStart == -1)
        return "";
    iStart += iLen + 1;
    var iEnd = query.indexOf("&", iStart);
    if (iEnd == -1)
        return query.substring(iStart);

    return query.substring(iStart, iEnd);
}

 

posted @ 2012-12-03 08:09  Damon201611  阅读(161)  评论(0编辑  收藏  举报