<div id="demo" style="position:absolute;z-index:3;top:160px;left:220px;overflow:auto;height:80px" onscroll="divcenter()">
     <table border="1">
<tr>
<td id="td1">ttt</td>
<td>ttt</td>
<td>ttt</td>
</tr>

</table>
<table border="1" cellpadding="1">
<tr style="BACKGROUND-COLOR: black" id="tr1">
<td>asf</td>
<td>asfdd</td>
<td>ddasf</td>
</tr>
</table>
</div>

解决方案 »

  1.   

    position:absolute;z-index:3;top:160px;left:220px;
    上面的CSS的意思就是采用绝对的,深度为3,顶为160,左为220位置显示
      

  2.   

    我的意思是说要固定上面的那个table的位置,当层有滚动条时候,table的位置固定,其他元素滚动。
      

  3.   

    try:
    <div id="demo" style="overflow:auto;height:80px;width:100" onscroll="t0.style.pixelTop=scrollTop">
    <table border="1" style="position:absolute" id=t0>
    <tr>
    <td id="td1">ttt</td>
    <td>ttt</td>
    <td>ttt</td>
    </tr>
    </table>
    <table border="1" cellpadding="1" height="200" id=t1 style="position:absolute">
    <tr id="tr1">
    <td>asf</td>
    <td>asfdd</td>
    <td>ddasf</td>
    </tr>
    </table>
    </div>
    <script>
    t1.style.pixelTop=t0.offsetTop+t0.offsetHeight
    </script>
      

  4.   

    他的代码正确的呀<div id="demo" style="overflow:auto;height:80px;width:500" onscroll="t0.style.pixelTop=scrollTop">
    <table border="1" style="position:absolute;z-index:2;"  bgcolor=#ff00ff  width=100% id=t0>//没动
    <tr>
    <td id="td1">ttt</td>
    <td>ttt中国人</td>
    <td>ttt</td>
    </tr>
    </table>
    <table border="1" cellpadding="1" height="200" bgcolor=#00ff00 width=100% id=t1 style="position:absolute;z-index:0;">//在动
    <tr id="tr1">
    <td>asf卡拉挖</td>
    <td>asfdd</td>
    <td>ddasf</td>
    </tr>
    </table>
    </div>
    <script>
    t1.style.pixelTop=t0.offsetTop+t0.offsetHeight
    </script>