<input type=button value=ok onclick=cc(this)><DIV id=dd1 style="z-index: 20; position: absolute; width:108; display:none">
<TABLE cellSpacing=0 cellPadding=0 border=0 width=><tbody>
<tr><td width=108 height=20 bgcolor=#FF0000</td></tr>
</tbody></TABLE></DIV><script language=javascript>
var HH,LL;
function getIE(e){
  var t=e.offsetTop;
  var l=e.offsetLeft;
  while(e=e.offsetParent){
    t+=e.offsetTop;
    l+=e.offsetLeft;
    }
HH = t;
LL = l;  
}function cc(tt)
{
getIE(tt);
var da = document.all.dd1.style;
da.top = HH + 6 + tt.clientHeight;
da.left= LL;
da.display = "";
}
//当然你还可以指定控件宽与层宽一致等等,你自己自由发挥
</script>

解决方案 »

  1.   

    offsetTop,clientHeight有什么区别?
    我用了后层都定位在同一个地方。好像不能获得每行文本框的位置。
      

  2.   

    <TABLE cellSpacing=0 cellPadding=0 border=0 width=><tbody>
    <tr>
      <td height=100 width=200 align=center><input type=button value=ok onclick=cc(this)></td>
      <td width=200 align=center><input type=button value=ok onclick=cc(this)></td>
      <td width=200 align=center><input type=button value=ok onclick=cc(this)></td>
    </tr><tr>
      <td width=200 align=center><input type=button value=ok onclick=cc(this)></td>
      <td width=200 align=center><input type=button value=ok onclick=cc(this)></td>
      <td width=200 align=center><input type=button value=ok onclick=cc(this)></td>
    </tr>
    </tbody></TABLE><DIV id=dd1 style="z-index: 20; position: absolute; width:108; display:none">
    <TABLE cellSpacing=0 cellPadding=0 border=0 width=><tbody>
    <tr><td width=108 height=20 bgcolor=#FF0000></td></tr>
    </tbody></TABLE></DIV><script language=javascript>
    var HH,LL;
    function getIE(e){
      var t=e.offsetTop;
      var l=e.offsetLeft;
      while(e=e.offsetParent){
        t+=e.offsetTop;
        l+=e.offsetLeft;
        }
    HH = t;
    LL = l;  
    }function cc(tt)
    {
    getIE(tt);
    var da = document.all.dd1.style;
    da.top = HH + 6 + tt.clientHeight;
    da.left= LL;
    da.display = "";
    }
    </script>