JQuery实现li菜单

$(function() {
	var ctrl = document.getElementById("mainframe");
	var $div_li = $("div.div_header ul li");
	$div_li.click(function() {
		var index = $div_li.index(this);
		
		if (index != 4){
			$("li.selected").removeClass( "selected" );
			$(this).addClass("selected");
		}
		
		if (index == 0) {ctrl.src = "";} 
		else if (index == 1) {ctrl.src = "";} 
		else if (index == 2) {ctrl.src = "";}
		else if (index == 3) {ctrl.src = "";} 
		else if (index == 4) {window.location.href = "logout.jsp";}
	}).hover(function() {
		$(this).addClass("hover");
	}, function() {
		$(this).removeClass("hover");
	});
});

Leave a Reply

Your email address will not be published. Required fields are marked *

*