文件:menu.js,只要在要使用的网页上的相应的位置加上代码:
<script language="javascript" src="menu.js"></script>
menu.js:
var mimgpath="../treeimg";
var mfonts="style=\"text-decoration:none;font-family: 宋体; font-size: 9pt; color: #000000; \"";
var movercolor="#0000FF";
var mnormalcolor="#000000";
var NC6=(navigator.userAgent.indexOf("Netscape6")>0)?true:false;
var IE=(document.all)?true:false;
function mOver(id) {
if (IE) {eval(id).style.color=movercolor; } 
else if(NC6){ document.getElementById(id).style.color=movercolor;}
}
function mOut(id) {
if (IE) {eval(id).style.color=mnormalcolor; } 
else if(NC6){ document.getElementById(id).style.color=mnormalcolor;}
}function mFolderExpand($1,$2,pic) {
if (IE) { mExpandIE($1,$2,pic) } 
else if(NC6){ mExpandNC($1,$2,pic) }
}function mExpandIE($1,$2,pic) {
Expanda = eval($1 + "a");
Expanda.blur()
ExpandChild = eval($1 + "Child");
    if ($2 != "top") { 
ExpandTree = eval($1 + "Tree");
//ExpandFolder = eval($1 + "Folder");
}
if (ExpandChild.style.display == "none") {
ExpandChild.style.display = "block";
        if ($2 != "top") { 
            if ($2 == "last") { ExpandTree.src = mimgpath+"/white.gif"; }
else { ExpandTree.src = mimgpath+"/white.gif"; }
//ExpandFolder.src = mimgpath+"/openfolder"+pic+".gif";
}
else { mmTree.src = mimgpath+"/topopen1.gif"; }
}else{
ExpandChild.style.display = "none";
        if ($2 != "top") { 
        if ($2 == "last") { ExpandTree.src = mimgpath+"/white.gif"; }
else { ExpandTree.src = mimgpath+"/white.gif"; }
//ExpandFolder.src = mimgpath+"/folder"+pic+".gif";
}
else { mmTree.src = mimgpath+"/top1.gif"; }
}
}
function mExpandNC($1,$2,pic) {
Expanda = document.getElementById($1 + "a");
Expanda.blur()
ExpandChild = document.getElementById($1 + "Child");
    if ($2 != "top") { 
ExpandTree = document.getElementById($1 + "Tree");
//ExpandFolder = document.getElementById($1 + "Folder");
}
if (ExpandChild.style.display == "none") {
ExpandChild.style.display = "block";
        if ($2 != "top") { 
            if ($2 == "last") { ExpandTree.src = mimgpath+"/white.gif"; }
else { ExpandTree.src = mimgpath+"/white.gif"; }
//ExpandFolder.src = mimgpath+"/openfolder"+pic+".gif";
}
else { document.getElementById("mmTree").src = mimgpath+"/topopen1.gif"; }
}else{
ExpandChild.style.display = "none";
        if ($2 != "top") { 
        if ($2 == "last") { ExpandTree.src = mimgpath+"/white.gif"; }
else { ExpandTree.src = mimgpath+"/white.gif"; }
//ExpandFolder.src = mimgpath+"/folder"+pic+".gif";
}
else {document.getElementById("mmTree").src = mimgpath+"/top1.gif"; }
}
}
with(document){
write("<div ID=\"mmChild\"><div ID=\"mm1Parent\"><a ID=\"mm1a\" target=\"_self\" href=\"#\" "+mfonts+" onClick=\"mFolderExpand('mm1',null,'0')\" title=\"\">");
write("<img ID=\"mm1Tree\" src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" border=\"0\"><font ID=\"mTitle1\" onmouseover=\"mOver('mTitle1')\" onmouseout=\"mOut('mTitle1')\">A</font></a>");
write("</div>");
write("<div ID=\"mm1Child\" style=\"display:none;\">");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"A.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle2\" onmouseover=\"mOver('mTitle2')\" onmouseout=\"mOut('mTitle2')\">A1</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"B.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle3\" onmouseover=\"mOver('mTitle3')\" onmouseout=\"mOut('mTitle3')\">A2</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"C.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle4\" onmouseover=\"mOver('mTitle4')\" onmouseout=\"mOut('mTitle4')\">A3</font></a><br>");
write("</div>");
write("<div ID=\"mm2Parent\"><a ID=\"mm2a\" target=\"_self\" href=\"#\" "+mfonts+" onClick=\"mFolderExpand('mm2',null,'0')\" title=\"\">");
write("<img ID=\"mm2Tree\" src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" border=\"0\"><font ID=\"mTitle5\" onmouseover=\"mOver('mTitle5')\" onmouseout=\"mOut('mTitle5')\">B</font></a>");
write("</div>");
write("<div ID=\"mm2Child\" style=\"display:none;\">");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"A.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle6\" onmouseover=\"mOver('mTitle6')\" onmouseout=\"mOut('mTitle6')\">B1</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"B.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle7\" onmouseover=\"mOver('mTitle7')\" onmouseout=\"mOut('mTitle7')\">B2</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"C.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle8\" onmouseover=\"mOver('mTitle8')\" onmouseout=\"mOut('mTitle8')\">B3</font></a><br>");
write("</div>");
write("<div ID=\"mm3Parent\"><a ID=\"mm3a\" target=\"_self\" href=\"#\" "+mfonts+" onClick=\"mFolderExpand('mm3','last','0')\" title=\"\">");
write("<img ID=\"mm3Tree\" src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" border=\"0\"><font ID=\"mTitle9\" onmouseover=\"mOver('mTitle9')\" onmouseout=\"mOut('mTitle9')\">C</font></a>");
write("</div>");
write("<div ID=\"mm3Child\" style=\"display:none;\">");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"A.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle10\" onmouseover=\"mOver('mTitle10')\" onmouseout=\"mOut('mTitle10')\">C1</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"B.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle11\" onmouseover=\"mOver('mTitle11')\" onmouseout=\"mOut('mTitle11')\">C2</font></a><br>");
write("<img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><img src=\""+mimgpath+"/white.gif\" align=\"absmiddle\" width=\"19\" height=\"20\" border=\"0\"><a target=\"_self\" href=\"C.ASP\" "+mfonts+" title=\"\"><font ID=\"mTitle12\" onmouseover=\"mOver('mTitle12')\" onmouseout=\"mOut('mTitle12')\">C3</font></a><br>");
write("</div>");
write("</div>");
}