<HEAD>
<TITLE>New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function show(){
document.getElementById("a").style.display = "none"
document.getElementById("b").style.display = "none"
}
function show_one(){
document.getElementById("a").style.display = "block"
document.getElementById("b").style.display = "block"
}
//-->
</SCRIPT>
<BODY>
<label type="text" id="a" value="姓名">姓名</label><input type="text" id="b"/><br>
<input type="button" value="隐藏" onclick="show()"/>
<input type="button" value="显示" onclick="show_one()"/>
</BODY>
</HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8">
<title>Document</title>
</head>
<body>
<a>其它相关</a>
<ul class="nav-sort sort-last">
<li><a href="" target='_blank'>子菜单1</a></li>
<li><a href="" target='_blank'>子菜单2</a></li>
<li><a href="" target='_blank'>子菜单3</a></li>
</ul>
</body>
<!-- 引入jquery -->
<script src="libs/script/jquery.min.js"></script>
<script type="text/javascript">
//把ul隐藏掉
$('.nav-sort.sort-last').hide()
//把 a 隐藏掉
$('.nav-sort.sort-last').prev().hide()
</script>
</html>
var length = $("dd a").length$("dd a").eq(length-1).hide()
$("dd a").eq(length-2).hide()
$("dd a").eq(length-3).hide()
eq是从0开始的,这样就会把后三个元素隐藏掉了