![]() |
#2
ztslove2010-06-19 19:09
|

<style type="text/css">
<!--
#d{
text-align:center;
color:#FF0000;
padding:5;
background:#009900;
border:2px solid #FF00FF ;
width:420;
height:150;
align:center;
}
#d div{
display:none;
}
#d .d1{
display:block;
}
#d .up{
color:#33FF00;
}
#d div{
margin-top:50;
color:#ffffff;
background-color:#669900;
height:100
}
#d h2{
float:left;
width:100px;
height:30px;
line-height:25px;
over-flow:hidden
text-align:center;
}
-->
</style>
<div id="d">
<h2 onClick="go_to(1)" >选择一</h2>
<h2 onClick="go_to(2)">选择二</h2>
<h2 onClick="go_to(3)">选择三</h2>
<h2 onClick="go_to(4)">选择四</h2>
<div class="d1">1111111</div>
<div>2222222</div>
<div>33333333</div>
<div>4444444</div>
</div>
<script language="javascript">
function go_to(ao)
{
var h=document.getElementById("d").getElementsByTagName("h2");
var d=document.getElementById("d").getElementsByTagName("div");
for(var i=0;i<h.length;i++)
{
if(ao-1==i)
{
d[i].className+="d1";
h[i].className+="up";
}else
{
h[i].className+=" ";
d[i].className+=" ";
}
}
}
</script>
<!--
#d{
text-align:center;
color:#FF0000;
padding:5;
background:#009900;
border:2px solid #FF00FF ;
width:420;
height:150;
align:center;
}
#d div{
display:none;
}
#d .d1{
display:block;
}
#d .up{
color:#33FF00;
}
#d div{
margin-top:50;
color:#ffffff;
background-color:#669900;
height:100
}
#d h2{
float:left;
width:100px;
height:30px;
line-height:25px;
over-flow:hidden
text-align:center;
}
-->
</style>
<div id="d">
<h2 onClick="go_to(1)" >选择一</h2>
<h2 onClick="go_to(2)">选择二</h2>
<h2 onClick="go_to(3)">选择三</h2>
<h2 onClick="go_to(4)">选择四</h2>
<div class="d1">1111111</div>
<div>2222222</div>
<div>33333333</div>
<div>4444444</div>
</div>
<script language="javascript">
function go_to(ao)
{
var h=document.getElementById("d").getElementsByTagName("h2");
var d=document.getElementById("d").getElementsByTagName("div");
for(var i=0;i<h.length;i++)
{
if(ao-1==i)
{
d[i].className+="d1";
h[i].className+="up";
}else
{
h[i].className+=" ";
d[i].className+=" ";
}
}
}
</script>