url:

http://xxxx.com?name=魅力&id=123

js中:

var name = getUrlParam("name");

/*通过正则获取url中的参数*/
function getUrlParam(name){
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  decodeURI(r[2]); return null;
}

05-02 20:54