代码如下: $(document).ready(function () { var locurl = location.href; var start = locurl.indexOf("?"); var end = locurl.length; var tempstr = locurl.substring(start + 1, end) var temp = tempstr.split("="); var parm = temp[1] - 1; $(".ny_leftc_ul ul li").eq(parm).find("a").addClass("newtxz"); });