http://www.111cn.net/js_a/javascript-dh/42458.htm
<style type="text/css">
*{margin:0;padding:0;}#nav{width:200px;margin:50px;}
#nav h3{cursor:pointer;line-height:30px;height:30px;background-color:#000000;color:#fff;}
#nav a{display:block;line-height:24px;color:#666666;}
#nav a:hover{background-color:#eee;color:#000;}
#nav div{display:none;border:1px solid #000;border-top:none;}
</style>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
window.onload = function(){
$("nav").onclick = function(e){
var src = e?e.target:event.srcElement;
if(src.tagName == "H3"){
var next = src.nextElementSibling || src.nextSibling;
next.style.display = (next.style.display =="block")?"none":"block";
}
}
}
</script>
<div id="nav">
<h3>建站服务</h3>
<div>
<a href="#">留言本</a>
<a href="#">播放器</a>
<a href="#">计数器</a>
</div>
<h3>站长工具</h3>
<div>
<a href="#">ALEXA查询</a>
<a href="#">PageRank查询</a>
<a href="#">收录查询</a>
</div>
</div>
</td>
</tr>
</table>