JS編寫(xiě)樹(shù)型結(jié)構(gòu)菜單
來(lái)源:易賢網(wǎng) 閱讀:781 次 日期:2015-04-27 10:45:16
溫馨提示:易賢網(wǎng)小編為您整理了“JS編寫(xiě)樹(shù)型結(jié)構(gòu)菜單”,方便廣大網(wǎng)友查閱!

<script language="JavaScript">

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;

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;

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;

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) {

whichEl = eval(el + "Child");

if (whichEl.style.display == "none") {

whichEl.style.display = "block";

}

else {

whichEl.style.display = "none";

}

}

else {

whichEl = eval("document." + el + "Child");

if (whichEl.visibility == "hide") {

whichEl.visibility = "show";

}

else {

whichEl.visibility = "hide";

}

arrange();

}

}

onload = initIt;

</script>

<div id="KB1Parent" class="parent"><a href="#"KB1"); return false" ><img src="img/plus.gif" border=0>文件夾一</a></div>

<div id="KB1Child" class="child">

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>頁(yè)面一</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt="" width="15" height="11"><img src="img/open.gif" border=0>頁(yè)面二</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt="" width="15" height="11"><img src="img/open.gif" border=0>頁(yè)面三</a>

</div>

<div id="KB2Parent" class="parent">

<a href="#"KB2"); return false" ><img src="img/plus.gif" border=0>文件夾二</a>

</div>

<div id="KB2Child" class="child"> 

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt="" width="15" height="11"><img src="img/open.gif" border=0>頁(yè)面一</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>頁(yè)面二</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt="" width="15" height="11"><img src="img/open.gif" border=0>頁(yè)面三</a>

</div>

<div id="KB3Parent" class="parent">

<a href="#"KB3"); return false" ><img src="img/plus.gif" border=0>文件夾三</a>

</div>

<div id="KB3Child" class="child">  

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>頁(yè)面一</a><br>

<a href="sample.htm" target="_blank" ><img src="img/open.gif" border=0>頁(yè)面二</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>頁(yè)面三</a>

</div>

<script language="JavaScript">

if (NS4) {

firstEl = "KB1Parent";

firstInd = getIndex(firstEl);

arrange();

}

</script>

更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄

更多信息請(qǐng)查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:JS編寫(xiě)樹(shù)型結(jié)構(gòu)菜單
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽(tīng)報(bào)名

  • 報(bào)班類(lèi)型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專(zhuān)用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)