日期:2014-05-16 浏览次数:20393 次
<script type="text/javascript">
window.onload=function ()
{
var oNav=document.getElementById('nav');
var aLi=oNav.getElementsByTagName('ul')[0].getElementsByTagName('li');
var aBox=getByClass(oNav,'box');
var i=0;
for (i=0; i<aLi.length; i++)
{
aLi[i].index=i
aLi[i].onclick=function ()
{
for (i=0; i<aLi.length; i++)
{
aBox[i].style.display='none'
}
aBox[this.index].style.display='block'
};
};
};
function getByClass(o,n)
{
var arr=[];
var s=o.getElementsByTagName('*');
for (var i=0; i<s.length; i++)
{
if (s[i].className==n)
{
arr.push(s[i]);
};
};
return arr;
};
</script>