首页 > 其他 > 详细

Day2----subMeau

时间:2014-11-22 00:43:38      阅读:246      评论:0      收藏:0      [点我收藏+]

//-----------------使用了index索引量来完成匹配区域的显示,使用Array数组灵活控制各单元颜色

<html>
<head>
<title>subMeau</title>
</head>
<style type="text/css">
li{float: left;width: 100px;text-align: center;list-style-type: none;}
.clear{clear: both;}
#subnav div{width: 300px;height: 100px;display: none;}
</style>
<script type="text/javascript">
window.onload=function(){
oLi=document.getElementsByTagName(‘li‘);
oDiv=document.getElementsByTagName(‘div‘);
var color=new Array(‘gray‘,‘green‘,‘pink‘);
for(var i=0;i<3;i++){
oLi[i].index=i;
oLi[i].style.background=color[i];
oLi[i].onmouseover=function(){
for(i=0;i<3;i++){
oDiv[i+1].style.display=‘none‘;
oDiv[this.index+1].style.display=‘block‘;
oDiv[this.index+1].style.background=color[this.index];
}
}
}
}
</script>
<body>
<ul>
<li>Andriod</li>
<li>IOS</li>
<li>WindowsPhone</li>
</ul>
<div class="clear"></div>
<ul id="subnav">
<li>
<div>This is the statement of the Andriod OS.</div>
</li>
<li>
<div>This is the statement of the IOS OS.</div>
</li>
<li>
<div>This is the statement of the WPhone OS.</div>
</li>
</ul>
</body>
</html>

Day2----subMeau

原文:http://www.cnblogs.com/fleshy/p/4114515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!