脚本说明:
第一步:把如下代码加入<head>区域中
<script language="javascript">
<!–
var bv=parseint(navigator.appversion);
var ns4=(document.layers) ? true : false;
var ie4=((document.all)&&(bv>=4))?true:false;
var ver4 = (ns4 || ie4) ? true : false;
function expandit(){return}
function expandall(){return}
function nomsg(){self.status="";}
if(ver4){
document.write("<scr"+"ipt language=\"javascript\" src=\"rsmenu.js\"></scr"+"i
pt>");
}
//–>
</script>
第二步:把如下代码加入<body>区域中
<span class="label"></span><br>
<!———- begin outline ———–>
<!–上方全部展开/关闭–>
<a href="#" onclick="expandall(false); return false"><img name="imex" src="bulle
t-plus.gif" width=9 height=9 border=0 alt="展开或关闭全部菜单"><font style="font-
size: 9pt">展开/关闭全部</font></a>
<!– <blockquote> –>
<!–第一级父菜单–>
<div id="eloneparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(elo
ne); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 borde
r=0 alt="展开全部菜单"> 主菜单一
</a></td></tr></table>
</div>
<!–第一级子菜单–>
<div id="elonechild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr>
<td height="12"> <a href="4.htm" target="data">连接页面4</a> </td>
</tr></table>
</div>
<!–第二级父菜单–>
<div id="eltwoparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(elt
wo); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 borde
r=0 alt="展开全部菜单"> 主菜单二
</a></td></tr></table>
</div>
<!–第二级子菜单–>
<div id="eltwochild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr><td>
<a href="4.htm" target="data">连接页面4</a>
</td></tr></table>
</div>
<!–第三级父菜单–>
<div id="elthreeparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(elt
hree); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 bor
der=0 alt="展开全部菜单"> 主菜单三
</a></td></tr></table>
</div>
<!–第三级子菜单–>
<div id="elthreechild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr><td>
<a href="4.htm" target="data">连接页面4</a>
</td></tr></table>
</div>
<!–第四级父菜单–>
<div id="elfourparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(elf
our); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 bord
er=0 alt="展开全部菜单"> 主菜单四
</a></td></tr></table>
</div>
<!–第四级子菜单–>
<div id="elfourchild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr><td>
<a href="4.htm" target="data">连接页面4</a>
</td></tr></table>
</div>
<!–第五级父菜单–>
<div id="elfiveparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(elf
ive); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 bord
er=0 alt="展开全部菜单"> 主菜单五
</a></td></tr></table>
</div>
<!–第五级子菜单–>
<div id="elfivechild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr><td>
<a href="4.htm" target="data">连接页面4</a>
</td></tr></table>
</div>
<!–第六级父菜单–>
<div id="elsixparent" class=parent style="margin-left: 0.1px">
<table border=1 cellspacing=0 cellpadding=0 width=101><tr><td class=label>
<a href="#" style="color:#ffff00; text-decoration:none;" onclick="expandit(els
ix); return false"><img name="imex" src="bullet-plus.gif" width=9 height=9 borde
r=0 alt="展开全部菜单"> 主菜单六
</a></td></tr></table>
</div>
<!–第六级子菜单–>
<div id="elsixchild" class=child style="margin-left: 0.5px">
<table border=1 cellspacing=0 cellpadding=0 width=96>
<tr><td>
<a href="1.htm" target="data">连接页面1</a><br>
</td></tr><tr><td>
<a href="2.htm" target="data">连接页面2</a><br>
</td></tr><tr><td>
<a href="3.htm" target="data">连接页面3</a><br>
</td></tr><tr><td>
<a href="4.htm" target="data">连接页面4</a>
</td></tr></table>
</div>
<!– </blockquote> –>
<!–下方全部展开/关闭–>
<div id="elexpparent" class=regular> <a href="#" onclick="expandall(true); retur
n false"><img name="imex" src="bullet-plus.gif" width=9 height=9 border=0 alt="展
开/关闭全部">展开/关闭全部</a> </div>
<!———- end outline ———–>
<br>
<script language="javascript1.2">
<!–
if(ns4){
firstel = "eloneparent";
firstind = getindex(firstel);
showall();
arrange();
}
//–>
</script>
rsment.js
isexpanded = false;
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 (ns4) {
for (i=0; i<document.layers.length; i++) {
whichel = document.layers[i];
if (whichel.id.indexof("child") != -1) whichel.visibility = "hide";
}
arrange();
}
else {
tempcoll = document.all.tags("div");
for (i=0; i<tempcoll.length; i++) {
if (tempcoll(i).classname == "child") tempcoll(i).style.display = "none";
}
}
}
function expandit(el) {
if (!ver4) return;
if (ie4) {expandie(el)} else {expandns(el)}
}
function expandie(el) {
whichel = eval(el + "child");
whichim = event.srcelement;
if (whichel.style.display == "none") {
whichel.style.display = "block";
whichim.src = "bullet-minus.gif";
}
else {
whichel.style.display = "none";
whichim.src = "bullet-plus.gif";
}
}
function expandns(el) {
whichel = eval("document." + el + "child");
whichim = eval("document." + el + "parent.document.images[imex]");
if (whichel.visibility == "hide") {
whichel.visibility = "show";
whichim.src = "bullet-minus.gif";
}
else {
whichel.visibility = "hide";
whichim.src = "bullet-plus.gif";
}
arrange();
}
function showall() {
for (i=firstind; i<document.layers.length; i++) {
whichel = document.layers[i];
whichel.visibility = "show";
}
}
function expandall(isbot) {
newsrc = (isexpanded) ? "bullet-plus.gif" : "bullet-minus.gif";
if (ns4) {
document.images["imex"].src = newsrc;
for (i=firstind; i<document.layers.length; i++) {
whichel = document.layers[i];
if (whichel.id.indexof("parent") != -1) {
whichel.document.images["imex"].src = newsrc;
}
if (whichel.id.indexof("child") != -1) {
whichel.visibility = (isexpanded) ? "hide" : "show";
}
}
arrange();
if (isbot && isexpanded) scrollto(0,document.layers[firstind].pagey);
}
else {
divcoll = document.all.tags("div");
for (i=0; i<divcoll.length; i++) {
if (divcoll(i).classname == "child") {
divcoll(i).style.display = (isexpanded) ? "none" : "block";
}
}
imcoll = document.images.item("imex");
for (i=0; i<imcoll.length; i++) {
imcoll(i).src = newsrc;
}
}
isexpanded = !isexpanded;
}
with (document) {
write("<style type=text/css>");
if (ns4) {
write(".parent {position:absolute; visibility:hidden}");
write(".child {position:absolute; visibility:hidden}");
write(".regular {position:absolute; visibility:hidden}")
}
else {
write(".child {display:none}")
}
write("</style>");
}
onload = initit;
