说明: 树形菜单
效果: 点这里看效果!
代码:
<html>
<head>
<title>网页特效 树形菜单2 夜鹰电脑教学网</title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<meta name="keywords" content="网页特效,页面导航,树形菜单,夜鹰电脑教学网">
<STYLE type=text/css>BODY {
MARGIN-TOP: 0px; FONT-SIZE: 9pt; MARGIN-LEFT: 4px; MARGIN-RIGHT:
0px;
FONT-FAMILY: "宋体"
}
A {
FONT-WEIGHT: 400; FONT-SIZE: 9pt; COLOR: black; TEXT-DECORATION:
none
}
A:hover {
FONT-WEIGHT: 400; FONT-SIZE: 9pt; COLOR: red; TEXT-DECORATION:
underline
}
A:active {
FONT: 9pt "宋体"; CURSOR: hand; COLOR: #ff0033
}
</STYLE>
<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>
</head>
<body>
<div id='KB1Parent' class='parent'><a href="#"
onClick="expandIt('KB1'); return false">
<IMG SRC='reply.gif' BORDER=0>分类一</a></div><div
id='KB1Child' class='parent'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<div id='KB2Parent' class='parent'><a href="#"
onClick="expandIt('KB2'); return false">
<IMG SRC='reply.gif' BORDER=0>分类二</a></div><div
id='KB2Child' class='child'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<div id='KB3Parent' class='parent'><a href="#"
onClick="expandIt('KB3'); return false">
<IMG SRC='reply.gif' BORDER=0>分类三</a></div><div
id='KB3Child' class='child'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<div id='KB4Parent' class='parent'><a href="#"
onClick="expandIt('KB4'); return false">
<IMG SRC='reply.gif' BORDER=0>分类四</a></div><div
id='KB4Child' class='child'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<div id='KB5Parent' class='parent'><a href="#"
onClick="expandIt('KB5'); return false">
<IMG SRC='reply.gif' BORDER=0>分类五</a></div><div
id='KB5Child' class='child'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<div id='KB6Parent' class='parent'><a href="#"
onClick="expandIt('KB6'); return false">
<IMG SRC='reply.gif' BORDER=0>分类六</a></div><div
id='KB6Child' class='child'>
<a href='time1.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0001</a><br>
<a href='time2.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0002</a><br>
<a href='time8.htm' target='_target'> <IMG SRC='shoucang.gif'
BORDER=0>0003</a></div>
<SCRIPT>
numTotal=6;scores[1]='KB1';
scores[2]='KB1';
scores[3]='KB2';
scores[4]='KB3';
scores[5]='KB4';
scores[6]='KB5'
</SCRIPT>
</body>
</html>
作者:佚名 来源: 网上转帖 |