网址带参数

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
    var r = window.location.search.substr(1).match(reg);
    if (r!=null) return (r[2]); return null;
};

var name = GetQueryString("prizeImg");
var name02 = decodeURI(GetQueryString("prizeName"));

$(function(){
    $(".pro-show").attr('src', name);
    $(".bao").text(name02);
});

 

你可能感兴趣的:(网址带参数)