0

代码:

window.location.href = "Posts?Category=" + sel;

如何获取类别页面中的值?

4

1 回答 1

0

尝试这个:

    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));

http://jsfiddle.net/kL9DJ/

于 2013-11-21T09:30:06.867 回答