码迷,mamicode.com
首页 > 编程语言 > 详细

javascript

时间:2016-09-12 22:09:08      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>

<style type="text/css">

*{
margin: 0;
padding: 0;
}
li{
list-style:none;
}
.the{
width: 303px;
height: 32px;
border-right: 1px red solid;

}
.the li{
width: 100px;
height: 30px;
border: 1px red solid;
border-right: none;
float: left;
line-height: 30px;
text-align: center;
}
.tab li{
width: 302px;
height: 300px;
border: 1px red solid;
line-height: 300px;
text-align: center;
border-top: none;

}
.tab{
width: 302px;
height: 300px;

}
.one{
width: 303px;
height: 404px;
margin: 0 auto;
}


</style>
</head>
<body>
<div class="one">
<ul class="the">
<li>a</li>
<li>b</li>
<li>c</li>
</ul>
<ul class="tab">
<li bgcolor="red">a</li>
<li style="display:none" bgcolor="green">b</li>
<li style="display:none" bgcolor="pink">c</li>
</ul>
</div>
<script type="text/javascript">
var eItemList=document.querySelectorAll(".the li"),
eContentList=document.querySelectorAll(".tab li");


for(var i=0;i<eItemList.length;i++){
eItemList[i].index=i;
eItemList[i].style.background="greem";

eItemList[i].onmouseover=function(){
//console.log(this.index);
for(var i=0;i<eContentList.length;i++){
//eContentList[i].style.background="red";
eContentList[i].style.display="none";
eItemList[i].style.background="none";
eContentList[i].style.background="none";
}
eContentList[this.index].style.display="block";
eItemList[this.index].style.background="green";
eContentList[1].style.background="pink";
eContentList[0].style.background="green";
eContentList[2].style.background="red";
}

//mouseout

};

</script>
<script type="text/javascript" src="wen.js"></script>
</body>
</html>

javascript

标签:

原文地址:http://www.cnblogs.com/qq547372511/p/5866260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!