百度空间 | 百度首页 
               
 
查看文章
 
纯css+ul+li的树,高速度。
2006-09-25 15:45

测试代码部分:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>分值登记</title>
<style>
 body { background: #779BE4;
   color: black;
   margin-left: 0px;
   margin-top: 0px;
   margin-right: 0px;
   margin-bottom: 0px;
            font-size:9pt ;
 }
        td { font-size:9pt ; }
 input { font-size: 9pt; }
  div.panel22 {
 height: 100%;
 width: 100%;
 border: 0px solid #000000;
 background-repeat: repeat;
 overflow: auto;
        background-color:#D6DFF7;
  }
#foldheader  { cursor: hand; font-weight: normal; list-style-image:  url(images/fold.gif)}
#foldinglist { font-weight: normal; list-style-image: url(images/list.gif); text-align: Left;
               text-indent: 5; margin-left: 5; margin-right: 2 }

</style>
<script language="javascript">

var head="display:''"
img1=new Image()
img1.src="images/fold.gif"
img2=new Image()
img2.src="images/open.gif"

function change(){
   if(!document.all)
      return
   if (event.srcElement.id=="foldheader") {
      var srcIndex = event.srcElement.sourceIndex
      var nested = document.all[srcIndex+2]
      if (nested.style.display=="none") {
         nested.style.display=''
         event.srcElement.style.listStyleImage="url(images/open.gif)"
      }
      else {
         nested.style.display="none"
         event.srcElement.style.listStyleImage="url(images/fold.gif)"
      }
   }
}

document.onclick=change

function _doSearch() {
   if(search.value!="") {
       for(i = contentBody.sourceIndex ; i < contentBody.sourceIndex + contentBody.all.length ; i++) {
           if(document.all(i).tagName == "A") {
               var text = document.all(i).innerText ;
               if(text.indexOf(search.value)>=0) {
                  //展开树
                  if(document.all(i).parentElement.parentElement.style.display=="none") {
                     document.all(i).parentElement.parentElement.style.display = "block" ;
                  }
                  document.all(i).parentElement.style.listStyleImage="url(images/red-ball.gif)" ;
                  document.all(i).scrollIntoView(true);
                  break ;
               }
           }
       }
   }
}

function _doSearchInput(){
  if(window.event.keyCode==13) {
    _doSearch();
  }
}
</script>
</head>

<body>

<table bordecolor="#FFFFFF" style="border-collapse: collapse ;" border="1" cellspacing="0" cellpadding="0" bgcolor="#D6DFF7" width="100%" height="100%" id="funTable">
 <tr>
  <td height="24">
  <table height="24"  class="O" border="0" cellspacing="0" width="100%" cellpadding="1">
   <tr>
    <td valign="middle" nowrap="nowrap">&nbsp;查找:</td>
    <td nowrap="nowrap"><input value name="searchtmp" type="hidden">
    <input value name="searchtmp1" type="hidden">
    <input onkeypress="javascript:_doSearchInput();" name="search" id="search" size="10" type="text"></td>
    <td onmouseout="className='P'" onmouseover="className='T'" valign="middle" class="P" nowrap="nowrap" onclick="javascript:_doSearch();" title="执行查询">
    <img hspace="3" align="absMiddle" height="11" width="11" src="images/message.gif">查询
    </td>
   </tr>
  </table>
  </td>
 </tr>
 <tr>
  <td>
  <div class="panel22" id="contentBody">
   <ul>
    <li id="foldheader">
    <a target="childMainFrame">1. 一级目录</a>
    </li>
    <ul style="display:none" id="foldinglist">
     <li  id="foldheader">
     <a target="childMainFrame" >
     2001. 二级目录</a> </li>
      <ul style="display:none" id="foldinglist">
      <li>
      <a href="http://www.zjoubbs.com" target=_blank> 碧海潮声</a>
      </li>
      </ul>
     <li>
     <a target="childMainFrame">
     2002. 杨俊华</a> </li>

    </ul>
    </li>
    <li id="foldheader">
    <a target="childMainFrame" >10.
    血液科</a> </li>
    <ul style="display:none" id="foldinglist">
     <li>
     <a target="childMainFrame">
     2148. 赵晔</a> </li>
     <li>
     <a target="childMainFrame">
     2149. 仇惠英</a> </li>


    </ul>
    </li>

   </ul>
  </div>
  </td>
 </tr>
</table>

</body>

</html>


类别:代码收藏 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu