墨色风雨
方法稍微改一下就完美了!!<script language="javascript">function changeTab(nIndex){var oLis=document.getElementById("tab").getElementsByTagName("li");var oDivs=document.getElementById("tab").getElementsByTagName("div");for(var i=0;i<oLis.length;i++){if(nIndex==i){oLis[i].className = "selectedLi";oDivs[i].className = "selectedDiv";}else{oLis[i].className = null;oDivs[i].className = null;}}}</script>