Home > Web Front-end > JS Tutorial > body text

jquery URL parameter judgment, determine menu style_jquery

WBOY
Release: 2016-05-16 18:25:58
Original
1141 people have browsed it
复制代码 代码如下:

$(function() {
var Param = window.location.href.split('?')[1];
var Uid;
var aq = Param.indexOf('&');
if (aq < 0) {
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;
})
})
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template