【发布时间】:2013-11-21 09:26:36
【问题描述】:
代码:
window.location.href = "Posts?Category=" + sel;
如何获取Category页面中的值?
【问题讨论】:
标签: javascript dom-events location-href
代码:
window.location.href = "Posts?Category=" + sel;
如何获取Category页面中的值?
【问题讨论】:
标签: javascript dom-events location-href
试试这个:
function getURLParameter(name, urlsearch) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(urlsearch || location.search) || [ , "" ])[1].replace(
/\+/g, '%20'))
|| null;
}
var url = "Posts?Category=1134324";
alert(getURLParameter('Category', url));
【讨论】: