Home  >  Article  >  Web Front-end  >  jquery URL参数判断,确定菜单样式_jquery

jquery URL参数判断,确定菜单样式_jquery

WBOY
WBOYOriginal
2016-05-16 18:25:581037browse
复制代码 代码如下:

$(function() {
var Param = window.location.href.split('?')[1];
var Uid;
var aq = Param.indexOf('&');
if (aq Uid = Param.substring(4);
} else {
var Psd = Param.split('&')[0];
Uid = Psd.substring(4);
}
var _NaN = /^\d{1,5}$/;
if (!_NaN.exec(Uid)) {
alert("参数错误!");
history.go( - 1);
};
$(".L_l_list_rp li").addClass("l_m_out");
$(".L_l_list_rp li").find("a").each(function(e) {
var lid = $(this).attr("href").substring(5);
if (lid == Uid) {
$(".L_l_list_rp li:eq(" + e + ")").removeClass("l_m_out").addClass("l_m_on")
}
});
$(".L_l_list_rp li").each(function() {
if ($(this).hasClass("l_m_out")) {
$(this).hover(function() {
$(this).removeClass("l_m_out").addClass("l_m_on")
},
function() {
$(this).removeClass("l_m_on").addClass("l_m_out")
})
}
});
$(".L_l_list_rp li").click(function() {
var href = $(this).find("a").attr("href");
location.href = href;
})
})
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn