标签:
<div id="cntR">
<div id="NewsTop">
<div id="NewsTop_tit">
<p></p>
<p class="topC0">iPhone</p>
<p class="topC0">iPad</p>
</div>
<div id="NewsTop_cnt">
<span></span>
<span>
<a href="#" target="_self">内容一</a>
</span>
<span>
<a href="#" target="_self">内容二</a>
</span>
</div>
<script>
var Tags=document.getElementById(‘NewsTop_tit‘).getElementsByTagName(‘p‘);
var TagsCnt=document.getElementById(‘NewsTop_cnt‘).getElementsByTagName(‘span‘);
var len=Tags.length;
var flag=1;//修改默认值
for(i=1;i<len;i++){
Tags[i].value = i;
Tags[i].onmouseover=function(){changeNav(this.value)};
TagsCnt[i].className=‘undis‘;
}
Tags[flag].className=‘topC1‘;
TagsCnt[flag].className=‘dis‘;
function changeNav(v){
Tags[flag].className=‘topC0‘;
TagsCnt[flag].className=‘undis‘;
flag=v;
Tags[v].className=‘topC1‘;
TagsCnt[v].className=‘dis‘;
}
</script>
</div>
</div>
#cntR {
width: 260px;
}
#NewsTop {
clear: both;
}
#NewsTop #NewsTop_tit {
border: 1px solid #E0E0E0;
width: 146px;
height: 24px;
margin: 0 auto;
}
#NewsTop #NewsTop_cnt {
height: 573px;
text-align: left;
}
#NewsTop p {
float: left;
line-height: 24px;
text-align: center;
font-size: 12px;
}
#NewsTop p.topC0 {
background: none repeat scroll 0% 0% #E0E0E0;
width: 73px;
color: #6B6C6C;
}
#NewsTop p.topC1 {
background: none repeat scroll 0% 0% #FFFFFF;
width: 73px;
color: #000;
cursor: pointer;
}
.dis {
display: block;
}
.undis {
display: none;
}
#NewsTop #NewsTop_cnt a {
color: #666;
text-decoration: none
}
#NewsTop #NewsTop_cnt a:hover {
color: #c2130e;
text-decoration: underline
}
标签:
原文地址:http://www.cnblogs.com/ybingbing_1213/p/4189260.html