1 jsp
<div>
<ul id="tags">
<li>
<a href="javascript:void(0)" οnclick="selectTag('tagContent0',this)" id="tag1">菜单1</a>
</li>
<li>
<a href="javascript:void(0)" οnclick="selectTag('tagContent1',this)" id="tag2">菜单2</a>
</li>
<li>
<a href="javascript:void(0)" οnclick="selectTag('tagContent2',this)" id="tag3">菜单3</a>
</li>
</ul>
<div id="tagContent" >
<div id="tagContent0">
内容1
</div>
<div id="tagContent1" style="display:none;">
内容2
</div>
<div id="tagContent2" style="display:none;">
内容3
</div>
</div>
</div>
2 js
function selectTag(showContent,selfObj){
$('#tags').find('li').each(function(){
$(this).removeClass('selectTag');
});
$('#tagContent').find("[id^='tagContent']").each(function(){
$(this).hide();
});
document.getElementById(showContent).style.display = "block";
}