树行菜单代码

<SCRIPT language=JavaScript1.2>
scores = new Array(20);
var numTotal=0;
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

if (ver4) {
    with (document) {
        write("<STYLE TYPE='text/css'>");
        if (NS4) {
            write(".parent {position:absolute; visibility:visible}");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        }
        else {
            write(".child {display:none}")
        }
        write("</STYLE>");
    }
}

function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}

function arrange() {
    nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}

function initIt(){
    if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
       }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);
            if (whichEl.className == "child") whichEl.style.display = "none";
        }
    }
}

function expandIt(el) {
 if (!ver4) return;
    if (IE4) {
        whichEl1 = eval(el + "Child");
  for(i=1;i<=numTotal;i++){
   whichEl = eval(scores[i] + "Child");
   if(whichEl!=whichEl1) {
    whichEl.style.display = "none";
   }
  }
        whichEl1 = eval(el + "Child");
        if (whichEl1.style.display == "none") {
            whichEl1.style.display = "block";
        }
        else {
            whichEl1.style.display = "none";
        }
    }
    else {
        whichEl = eval("document." + el + "Child");
  for(i=1;i<=numTotal;i++){
   whichEl = eval("document." + scores[i] + "Child");
   if(whichEl!=whichEl1) {
    whichEl.visibility = "hide";
   }
  }
        if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
        }
        else {
            whichEl.visibility = "hide";
        }
        arrange();
    }
}
onload = initIt;
</SCRIPT>

************************************************************************************

添加树内容

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="93%" id="AutoNumber11">
                              <tr>
            <TD>            <img  src="imgs/x1_1_4.gif" width="40" height="24"><A href="#" class="style1" onFocus="blur()" onClick="expandIt('L1'); return false">『 <B>关于课件</B>
                』</A><br>
              <DIV class=child style1 id=L1Child style="width: 174; height: 40">
     <span class="style1">
     <img src="imgs/x1_1.gif" width="57" height="16" border="0"><a target="frmRight" onFocus="blur()" href="articles/use/1.html">主要原因</a><br>
            
    <img src="imgs/x1_1.gif" width="57" height="16" border="0"><a target="frmRight" onFocus="blur()" href="articles/use/2.html">主要作用</a><BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0"><a target="frmRight" onFocus="blur()" href="articles/use/1.html">主要问题</a><BR>
               
                <img src="imgs/x1_1.gif" width="57" height="16" border="0"><a target="frmRight" onFocus="blur()" href="articles/use/1.html">解决办法</a></span><BR>
              
              </DIV>
             
            <DIV class="style1" id=L2Parent style="width: 174; height: 21">
              <img src="imgs/x1_1_5.gif" width="40" height="24" border="0"><A href="#" onClick="expandIt('L2'); return false" onFocus="blur()" title="市场营销的重要作用">『
              <b>第一章</b>
                』</A></DIV>
               
                <DIV class=child style1 id=L2Child style="width: 173; height: 40">
               
              <span class="style1"><img src="imgs/x1_1.gif" width="57" height="16" border="0"><a href="articles/1/1.html" target="frmRight">XXXXXXX</a><BR>
              
              <img src="imgs/x1_1.gif" width="57" height="16" border="0"><a href="articles/1/2.html" target="frmRight">XXXXXXX</a><BR>
              
              <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
              <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX</span><BR>
              
              </DIV>
             
            <DIV class="style1" id=L3Parent><img src="imgs/x1_1_2.gif" width="40" height="24" border="0"><A href="#" onClick="expandIt('L3'); return false" onFocus="blur()">『 <strong>第二章 </strong>』</A></DIV>
               
                <DIV class=child style1 id=L3Child>              <span class="style1"><img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX</span><BR>
              
              </DIV>
             
            <DIV class="style1" id=L4Parent><img src="imgs/x1_1_1.gif" width="40" height="24" border="0"><A href="#" onFocus="blur()" onClick="expandIt('L4'); return false">『
              <b>第三章</b>
                』</A></DIV>
               
                <DIV class=child style1 id=L4Child>              <span class="style1"><img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
             
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
             
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
             
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXX<BR>
              
              </span></DIV>
             
            <DIV class="style1" id=L5Parent><img src="imgs/x1_1_3.gif" width="40" height="24" border="0"><A href="#" onClick="expandIt('L5'); return false" onFocus="blur()">『
                  <b>第四章</b>
                』</A></DIV>
               
                <DIV class=child style2 id=L5Child>              <span class="style1"><img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX<BR>
              
                <img src="imgs/x1_1.gif" width="57" height="16" border="0">XXXXXXX</span><BR>
              
              </DIV>
             
                       
              <SCRIPT>numTotal=5;scores[1]='L1';scores[2]='L2';scores[3]='L3';scores[4]='L4';scores[5]='L5';</SCRIPT>
                              </tr>
                              <tr>
                                <td width="100%"> </td>
                              </tr>
      </table>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值