How to modify the style of jQuery under li, and modify the SRC value of img under li, the following is the specific implementation code, you need to see friends
$(".test li").click(function() {
$(".test li a").removeClass("test01");
$(".test li a").addClass("test02");
$("a", this).removeClass("test02");//The a tag in the current li
$("a", this).addClass("test01");
var title_index = $(this).index();//Index of current li
//All imgs in li
var allImg = $(".test li img");
for ( var i = 0; i < allImg.size(); i++) {
if (i % 2 == 0) {
$(allImg[i]).attr("src", "images/b04.gif");//Change the SRC of img
} else {
$(allImg[i]).attr("src", "images/b05.gif");
}
}
//Img in the current li
var imgs = $("img", this);
for ( var i = 0; i < imgs.size(); i++) {
if (i == 0) {
$(imgs[i]).attr("src", "images/b01.gif");
} else {
$(imgs[i]).attr("src", "images/b02.gif");
}
}
if (title_index == 0) {
$("#a).hide();
$("#b").show();
} else {
$("#b").hide();
$("#a").show();
}
})