<script language="JavaScript">
var st=new Array(0,0,0,0);
function openclose(tree,img,i){
if(st[i]==0)
{tree.style.display="block";img.src="open.gif";st[i]=1;}
else
{tree.style.display="none";img.src="close.gif";st[i]=0;}}
document.write('<table style="font:9pt 宋体" width="153" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td><a style="cursor:hand" onclick="openclose(menu1,img_menu1,1);"><img src="close.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu1"><FONT style="BACKGROUND-COLOR: #ccffff" color=blue>防洪预案演示</font></a></td></tr>');
document.write('<tr align="right" valign="top"><td>');
document.write('<table id="menu1" style="display:none;font:9pt 宋体" width="153" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu5"></a><a class=aa href="../../fhya/wz/index.htm" target="_blank">多媒体演示</a></td></tr>');
//document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu6"></a><a class=aa href="dingwei_temp.asp" target="cen_bottom">新项目</a></td></tr>');
document.write('</table></td></tr>');
document.write('<tr><td><a style="cursor:hand" onclick="openclose(menu2,img_menu2,2);"><img src="close.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu2"><FONT style="BACKGROUND-COLOR: #ccffff" color=blue>汛情信息接收</font></a></td></tr>');
document.write('<tr align="right" valign="top"><td>');
document.write('<table id="menu2" style="display:none;font:9pt 宋体" width="153" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu7"></a><a class=aa href="dingwei_temp.asp" target="cen_bottom">文本信息</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu8"></a><a class=aa href="dingwei_temp.asp" target="cen_bottom">图片信息</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu9"></a><a class=aa href="dingwei_temp.asp" target="cen_bottom">音频信息</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu10"></a><a class=aa href="dingwei_temp.asp" target="cen_bottom">视频信息</a></td></tr>');
document.write('</table></td></tr>');document.write('<tr><td><a style="cursor:hand" onclick="openclose(menu3,img_menu3,3);"><img src="close.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu3"><FONT style="BACKGROUND-COLOR: #ccffff" color=blue>现场抗洪实况</font></a></td></tr>');
document.write('<tr align="right" valign="top"><td>');
document.write('<table id="menu3" style="display:none;font:9pt 宋体" width="153" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu11"></a><a class=aa href=javascript:{opwin("xqjs.asp")}>汛情监视</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu12"></a><a class=aa href=javascript:{openwin("frame_qkz.htm")}>指挥部署</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu13"></a><a class=aa href=javascript:{openwin("frame_rlwz.htm")}>人力物资</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu14"></a><a class=aa href=javascript:{openwin("SZQK.asp")}>受灾情况</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu17"></a><a class=aa href=javascript:{openwin("frame_tfsk.htm")}>台风实况</a></td></tr>');
document.write('</table></td></tr>');
document.write('<tr><td><a style="cursor:hand" onclick="openclose(menu4,img_menu4,4);"><img src="close.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu4"><FONT style="BACKGROUND-COLOR: #ccffff" color=blue>地方抗洪组织情况</font></a></td></tr>');
document.write('<tr align="right" valign="top"><td>');
document.write('<table id="menu4" style="display:none;font:9pt 宋体" width="153" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="circ.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu15"></a><a class=aa href=javascript:{openwin("dfkhzz.asp")}>地方抗洪组织情况</a></td></tr>');
document.write('<tr><td class=font1><a style="cursor:hand" ><img src="finish.gif" width="33" height="15" align="absmiddle" border="0" name="img_menu16"></a><a class=aa href=javascript:{openwin("dfkhzzlxfs.asp")}>地方抗洪组织联系方式</a></td></tr>');
document.write('</table>');
</script>

解决方案 »

  1.   

    <html><style><!--#foldheader{cursor:hand ; font-weight:bold ;list-style-image:url(fold.gif)}#foldinglist{list-style-image:url(list.gif)}file://--></style><script language="JavaScript1.2"><!--/** * Based on Folding Menu Tree * Dynamic Drive (www.dynamicdrive.com)* For full source code, installation instructions,* 100's more DHTML scripts, and Terms Of* Use, visit dynamicdrive.com** Updated to support arbitrarily nested lists* by Mark Quinn (@robocast.com) November 2nd 1998*/var PrevOpenItem = null; var head="display:''"img1=new Image()img1.src="fold.gif"img2=new Image()img2.src="open.gif"function CloseItem(Item)
    {
      if (Item)
      {
        var srcIndex = Item.sourceIndex;
        var nested = document.all[srcIndex+1];    if (nested.style.display=="none") 
        {
          nested.style.display='';
          Item.style.listStyleImage="url(open.gif)";
        }    else 
        {
          nested.style.display="none";
          Item.style.listStyleImage="url(fold.gif)";
        }
      }
    }function change(){if(!document.all)returnif (event.srcElement.id=="foldheader") {CloseItem(PrevOpenItem);
    PrevOpenItem = event.srcElement;var srcIndex = event.srcElement.sourceIndexvar nested = document.all[srcIndex+1]if (nested.style.display=="none") {nested.style.display=''event.srcElement.style.listStyleImage="url(open.gif)"}else {nested.style.display="none"event.srcElement.style.listStyleImage="url(fold.gif)"}}} document.onclick=change //--></script> <head></head><body> <ul> <li id="foldheader">Games</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.gamespot.com">GameSpot</a></li><li><a href="http://www.happypuppy.com">Happy Puppy</a></li><li><a href="http://www.gamecenter.com">Game Center</a></li></ul> <a href="http://www.sina.com.cn"><li id="foldheader">News</li></a><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.cnn.com">CNN</a></li><li><a href="http://www.abcnews.com">ABC News</a></li><li><a href="http://www.vancouversun.com">Vancouver Sun</a></li></ul> <li id="foldheader">Software</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.download.com">outer 1</a></li><li><a href="http://www.hotfiles.com">outer 2</a></li><li id="foldheader">Nested</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.windows95.com">nested 1</a></li><li><a href="http://www.shareware.com">nested 2</a></li></ul><li><a href="http://www.windows95.com">outer 3</a></li><li><a href="http://www.shareware.com">outer 4</a></li></ul></ul> <script language="JavaScript1.2"><!--/*** Get cookie routine by Shelley Powers * ([email protected])*/function get_cookie(Name) {var search = Name + "="var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search)// if cookie existsif (offset != -1) { offset += search.length// set index of beginning of valueend = document.cookie.indexOf(";", offset);// set index of end of cookie valueif (end == -1) end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end))}}return returnvalue;} if (get_cookie(window.location.pathname) != ''){var openresults=get_cookie(window.location.pathname).split(" ")for (i=0 ; i < openresults.length ; i++){foldinglist[openresults[i]].style.display=''document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImage="url(open.gif)"}} if (document.all){var nodelength=foldinglist.length-1var nodes=new Array(nodelength)var openones=''} function check(){for (i=0 ; i <= nodelength ; i++){if (foldinglist[i].style.display=='')openones=openones + " " + i}document.cookie=window.location.pathname+"="+openones} if (document.all)document.body.onunload=check//--></script>
    </body></html>
      

  2.   

    zhanghk(lion) 我给你回复收到了么?
      

  3.   

    zhanghk(lion) 您好:
    非常感谢您,您给我的代码在一层目录下正确,但对多层目录可能会有问题:
    比如:我的“software”下“nested”下的内容显示不出来。
    另外当点击完“nested” 完毕后,显示其内容,但当我点击“game”,是否能关闭整个“software”,希望能不再次给出代码。谢谢
      

  4.   

    <html><style><!--#foldheader{cursor:hand ; font-weight:bold ;list-style-image:url(fold.gif)}#foldinglist{list-style-image:url(list.gif)}file://--></style><script language="JavaScript1.2"><!--/** * Based on Folding Menu Tree * Dynamic Drive (www.dynamicdrive.com)* For full source code, installation instructions,* 100's more DHTML scripts, and Terms Of* Use, visit dynamicdrive.com** Updated to support arbitrarily nested lists* by Mark Quinn (@robocast.com) November 2nd 1998*/var PrevOpenItem = null; var head="display:''"img1=new Image()img1.src="fold.gif"img2=new Image()img2.src="open.gif"function IsChildItem(ParentItem, ChildItem)
    {
      if (ParentItem && ChildItem)
      {
        var p = ChildItem.parentNode;
        if (p.id == "foldinglist" && document.all[p.sourceIndex-1] == ParentItem)
          return true;
      }  return false;
    }function CloseItem(Item)
    {
      if (Item)
      {
        var srcIndex = Item.sourceIndex;
        var nested = document.all[srcIndex+1];    if (nested.style.display=="none") 
        {
          nested.style.display='';
          Item.style.listStyleImage="url(open.gif)";
        }
        else 
        {
          nested.style.display="none";
          Item.style.listStyleImage="url(fold.gif)";
        }
      }
    }function change(){if(!document.all)returnif (event.srcElement.id=="foldheader") {if (!IsChildItem(PrevOpenItem, event.srcElement))
    {
      CloseItem(PrevOpenItem, event.srcElement);
      PrevOpenItem = event.srcElement;
    }var srcIndex = event.srcElement.sourceIndexvar nested = document.all[srcIndex+1]if (nested.style.display=="none") {nested.style.display=''event.srcElement.style.listStyleImage="url(open.gif)"}else {nested.style.display="none"event.srcElement.style.listStyleImage="url(fold.gif)"}}} document.onclick=change //--></script> <head></head><body> <ul> <li id="foldheader">Games</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.gamespot.com">GameSpot</a></li><li><a href="http://www.happypuppy.com">Happy Puppy</a></li><li><a href="http://www.gamecenter.com">Game Center</a></li></ul> <a href="http://www.sina.com.cn"><li id="foldheader">News</li></a><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.cnn.com">CNN</a></li><li><a href="http://www.abcnews.com">ABC News</a></li><li><a href="http://www.vancouversun.com">Vancouver Sun</a></li></ul> <li id="foldheader">Software</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.download.com">outer 1</a></li><li><a href="http://www.hotfiles.com">outer 2</a></li><li id="foldheader">Nested</li><ul id="foldinglist" style="display:none" style=&{head};><li><a href="http://www.windows95.com">nested 1</a></li><li><a href="http://www.shareware.com">nested 2</a></li></ul><li><a href="http://www.windows95.com">outer 3</a></li><li><a href="http://www.shareware.com">outer 4</a></li></ul></ul> <script language="JavaScript1.2"><!--/*** Get cookie routine by Shelley Powers * ([email protected])*/function get_cookie(Name) {var search = Name + "="var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search)// if cookie existsif (offset != -1) { offset += search.length// set index of beginning of valueend = document.cookie.indexOf(";", offset);// set index of end of cookie valueif (end == -1) end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end))}}return returnvalue;} 
    /*
    if (get_cookie(window.location.pathname) != ''){var openresults=get_cookie(window.location.pathname).split(" ")for (i=0 ; i < openresults.length ; i++){foldinglist[openresults[i]].style.display=''document.all[foldinglist[openresults[i]].sourceIndex -1].style.listStyleImage="url(open.gif)"}}
    */
     if (document.all){var nodelength=foldinglist.length-1var nodes=new Array(nodelength)var openones=''} function check(){for (i=0 ; i <= nodelength ; i++){if (foldinglist[i].style.display=='')openones=openones + " " + i}document.cookie=window.location.pathname+"="+openones} if (document.all)document.body.onunload=check//--></script>
    </body></html>
      

  5.   

    zhanghk(lion): 快点回复呀,我好给分结贴呀
      

  6.   

    zhanghk(lion) 给你加的分看到了么