您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

JS获取URL中的参数数据_javascript技巧

2024/11/16 9:49:05发布31次查看
复制代码 代码如下:
function getparam(paramname) {
    paramvalue = ;
    isfound = false;
    if (this.location.search.indexof(?) == 0 && this.location.search.indexof(=) > 1) {
        arrsource = unescape(this.location.search).substring(1, this.location.search.length).split(&);
        i = 0;
        while (i             if (arrsource[i].indexof(=) > 0) {
                if (arrsource[i].split(=)[0].tolowercase() == paramname.tolowercase()) {
                    paramvalue = arrsource[i].split(=)[1];
                    isfound = true;
                }
            }
            i++;
        }
    }
    return paramvalue;
}
如:http://www.jb51.net/userquery.aspx?id=202
getparam(id)为202
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product