本帖最后由 kd55850818 于 2010-04-22 16:27:57 编辑

解决方案 »

  1.   

    document.write("<div id=\""+nodeValues[0]+"\" ; overflow : hidden ; height: 0px \">
    ---》》》document.write("<div id=\""+nodeValues[0]+"\" style=\"overflow : hidden ; height: 0px \">
      

  2.   

    overflow是设置滚动条的,如果你要让DIV不显示的话,用display: none;在JAVASCRIPT里面控制DIV显示不显示用下面的代码.
      style="display: none;"
      document.getElementById("typediv1").style.display="none";//隐藏
      document.getElementById("typediv1").style.display="";//显示 
      

  3.   

    display:none我也用过这个属性,但是我这里是要通过控制height的值实现动态的滚动效果
      

  4.   

    下面这样生成的HTML文件,表格内容是显示不出来的.还是你的JAVASCRIPT逻辑有问题吧?<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    </head>
    <body>
    <div style="overflow:hidden; height:0px; ">
    <table>
    <tbody>
    <tr>
    <td>
    aaaa
    </td>
    <td>
    bbbb
    </td>
    </tr>
    <tr>
    <td>
    aaaa
    </td>
    <td>
    bbbb
    </td>
    </tr>
    </tbody>
    </table>
    </div>
    </body>
    </html>
      

  5.   

    源码我看过了,没有问题,
    我把问题稍微改改也许更方便回答。
    譬如我写了个JSP页面,body代码如下<body>
      <table cellspacing="0" cellpadding="0" width="193" border="0">
    <tbody> <tr onmouseover="this.className = 'showLine';"
    onclick="isShow(document.getElementById('menu_1'), 'menu_1');"
    onmouseout="this.className = '';">
    <td background="../style/images/left_title_bg.jpg" height="29">
    <div class="title_font" align="center">
    评估反馈
    </div>
    </td>
    </tr>
    <tr>
    <td valign="top" background="images/left_bg.gif">
    <div id="menu_1" style="OVERFLOW: hidden;height:0px"> <table style="MARGIN: 0px" cellspacing="0" cellpadding="0"
    width="100%" border="0">
    <tbody>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_1.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="评估实施.html" target="mainFrame">评估实施</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_2.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="实施管理1.html" target="mainFrame">实施管理</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_3.gif" width="15" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="评估查询.html" target="mainFrame">评估查询</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    </tbody>
    </table> </div>
    </td>
    </tr>
    <tr onmouseover="this.className = 'showLine';"
    onclick="isShow(document.getElementById('menu_2'), 'menu_2');"
    onmouseout="this.className = '';">
    <td background="../style/images/left_title_bg.jpg" height="29">
    <div class="title_font" align="center">
    评估管理
    </div>
    </td>
    </tr>
    <tr>
    <td valign="top" background="images/left_bg.gif">
    <div id="menu_2" style="OVERFLOW: hidden; HEIGHT: 0px"> <table style="MARGIN: 0px" cellspacing="0" cellpadding="0"
    width="100%" border="0">
    <tbody>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_8.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="模板管理1.html" target="mainFrame">评估模板</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_9.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="评估方式.html" target="mainFrame">评估方式</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_17.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="维度管理.html" target="mainFrame">维度管理</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_18.gif" width="16" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="指标管理1.html" target="mainFrame">指标管理</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    <tr onmouseover="className += ' showLine menuMouse';"
    onmouseout="className = className.replace('showLine menuMouse', '');"
    class="left_menu">
    <td height="33" align="left">
    <div class="left_table">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="20" align="center">
    <img src="../style/images/left_menu_21.gif" width="14" height="16"
    border="0" />
    </td>
    <td align="left">
    <a href="人员管理1.html" target="mainFrame">人员管理</a>
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    </body><div style="overflow:hidden;height:0px">,但是现实效果仍然是所有的子节点都是打开的。
    期待高手出现,谢谢``
      

  6.   


    是这样,首先生成trtd的JavaScript是没有问题的,我查看了源代码.其次我在静态页面上这么写,也是不现实的,但是放到jsp里面写就无法实现这样的效果。
    而且JavaScript只是我点击之后或者onmouse时才会被激活,是否能够正常实现效果,应该跟JavaScript没关系才对.
      

  7.   


    是这样,首先生成trtd的JavaScript是没有问题的,我查看了源代码.其次我在静态页面上这么写,也是不现实的,但是放到jsp里面写就无法实现这样的效果。
    而且JavaScript只是我点击之后或者onmouse时才会被激活,是否能够正常实现效果,应该跟JavaScript没关系才对.
      

  8.   

    lz用的浏览器是什么版本?估计是浏览器兼容问题。
    一点建议,最好用JQuery来控制,或者用一些现成的js库。
      

  9.   

      <div id="menu_2" style="OVERFLOW: hidden; HEIGHT: 0px">--->>>>
      <div id="menu_2" style="display:none; HEIGHT: 0px">
    上面的---------------
    <tr onmouseover="this.className = 'showLine';"
                        onclick="isShow(document.getElementById('menu_1'), 'menu_1');"
                        onmouseout="this.className = '';">---->>>>>>>
    onclick调用的js的function里面:
    document.getElementById('menu_1').style.display='';
    来显示这一个指定的id的div我js很弱的,最近也在整这个,烦啊
      

  10.   


    我这里之所以要用overflow:hidden和 height:0px来控制它就是想要缓慢展开的效果(随着e.style.height的值的增加,div一点一点的展现开).display:none虽然可以实现隐藏效果,不过无法实现这个效果.我js也很弱,所以在求助,期盼高手出现.