足球游戏_中国足彩网¥体育资讯$

JS编写树型结构菜单
来源:易贤网 阅读:769 次 日期:2015-04-27 10:45:16
温馨提示:易贤网小编为您整理了“JS编写树型结构菜单”,方便广大网友查阅!

<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>页面一</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>页面二</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>页面三</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>页面一</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>页面二</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>页面三</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>页面一</a><br>

<a href="sample.htm" target="_blank" ><img src="img/open.gif" border=0>页面二</a><br>

<a href="sample.htm" target="_blank" ><img src="img/spacer.gif" border=0 alt=""><img src="img/open.gif" border=0>页面三</a>

</div>

<script language="JavaScript">

if (NS4) {

firstEl = "KB1Parent";

firstInd = getIndex(firstEl);

arrange();

}

</script>

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看脚本栏目
易贤网手机网站地址:JS编写树型结构菜单
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65099533/13759567129 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标