一个简单css效果

<html>
<head>
<title> new document </title>
<link type="text/css" rel="stylesheet" href="style.css" />
<script type="text/javascript">
function ShowTree(obj)
{
 whichEl = eval(obj);
 
 if (whichEl.style.display == "none")
 {
  var div = document.getElementsByTagName("div");
  for (i=0; i<div.length; i++)
  {
   if (div[i].className == whichEl.className)
   {
    div[i].style.display = "none";
   }
  }
  eval(obj + ".style.display=/"/";");
 }
 else
 {
  eval(obj + ".style.display=/"none/";");
 }
}

function ShowMain(obj1,obj2)
{
 whichEl = eval(obj1);
 if (whichEl.style.display == "")
 {
  eval(obj1 + ".style.display=/"none/";");
  eval(obj2 + ".style.display=/"/";");
 }
 else
 {
  eval(obj1 + ".style.display=/"/";");
  eval(obj2 + ".style.display=/"none/";");
 }
}
</script>
</head>

<body>

<div id="f1" class="frame_style" style="display:;">
 <div class="main_style">
  <div id="div1" class="title_style" οnclick="ShowTree('data1')">test</div>
  <div id="data1" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
  <div id="div2" class="title_style" οnclick="ShowTree('data2')">test</div>
  <div id="data2" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
 </div>
</div>
<div class="space_style"><div οnclick="ShowMain('f1','f2')"></div></div>

<div id="f2" class="frame_style" style="display:none;">
 <div class="main_style">
  <div id="div3" class="title_style" οnclick="ShowTree('data3')">test2</div>
  <div id="data3" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
  <div id="div4" class="title_style" οnclick="ShowTree('data4')">test2</div>
  <div id="data4" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
 </div>
</div>
<div class="space_style"><div οnclick="ShowMain('f2','f3')"></div></div>


<div id="f3" class="frame_style" style="display:none;">
 <div class="main_style">
  <div id="div5" class="title_style" οnclick="ShowTree('data5')">test3</div>
  <div id="data5" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
  <div id="div6" class="title_style" οnclick="ShowTree('data6')">test3</div>
  <div id="data6" class="data_style" style="display:none;">
   <ul>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
    <li>asdf</li>
   </ul>
  </div>
 </div>
</div>
</body>
</html>

style.css

a,input{
    behavior:url('blur.htc');
}

body
{
    margin:10px;
}
body,td,th,p,span,div,li{
 font-size:12px;
 line-height:150%;
 font-family:"宋体", Arial;
}
input{
 border-top-color:#CCCCCC;
 border-left-color:#CCCCCC;
 border-right-color:#999999;
 border-bottom-color:#999999;
 border-width:1px;
 border-style:solid;
 background-color:#FFFFFF;
 font-size:12px;
 padding-top:1px;
 float:right;
}

.frame_style{
 float:left;
}
.main_style{
 float:left;
 width:300px;
 height:350px;
 overflow:hidden;
}

.title_style{
 cursor:hand;
 padding:4px;
 padding-left:16px;
 margin-bottom:4px;
 border-color:#E1E1E1;
 border-style:solid;
 border-width:1px;
 width:300px;
 background-color:#FAFAFA;
}

.data_style{
 border-color:#F1F1F1;
 border-style:solid;
 border-width:1px;
 width:300px;
 background-color:FAFAFA;
}
.data_style ul{
 list-style-type:none;
 margin:0px;
 padding:10px;
}

.space_style{
 margin:4px;
 border-color:#F1F1F1;
 border-style:solid;
 border-width:1px;
 width:6px;
 height:340px;
 background-color:#FAFAFA;
 float:left;
}
.space_style div{
 cursor:hand;
 background-color:#CCCCCC;
 width:100%;
 height:20px;
 margin-top:160px;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值