如何改变树型菜单的背景颜色

如何在树型菜单选中某一项时,使该项的背景的颜色改变,我使用的是div区域控制,也就是使超连接的背景改变,选中那项,该项就改变,以前选中的恢复原来的颜色
---------------------------------------------------------------

 1<body>
 2<script>   
 3var h=null   
 4function hit(obj){   
 5if(!h)h=obj;   
 6h.style.backgroundColor='';   
 7h=obj;   
 8obj.style.backgroundColor='red'   
 9}   
10</script>
11<a href="#" onclick="hit(this)">fason</a>
12<a href="#" onclick="hit(this)">fason</a>
13<a href="#" onclick="hit(this)">fason</a>
14<a href="#" onclick="hit(this)">fason</a>
15<a href="#" onclick="hit(this)">fason</a>
16</body>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus