<SCRIPT LANGUAGE="JavaScript">
<!--
function showdiv()
{
var the_obj = event.srcElement;
test.innerHTML = the_obj.innerHTML;
test.style.top = the_obj.getBoundingClientRect().top + the_obj.clientHeight;
test.style.left = the_obj.getBoundingClientRect().left + the_obj.clientWidth;
test.style.display='';
}
function hiddendiv()
{
test.style.display = 'none';
}
//-->
</SCRIPT>
<DIV ID="test" STYLE="position:absolute;display:none; border:1px solid red;"></DIV>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD WIDTH="100" STYLE="BORDER:1px solid #000000;" OnMouseOver="showdiv()" OnMouseOut="hiddendiv()">
ASDFADF
</TD>
</TR>
</TABLE>

解决方案 »

  1.   

    以前别人写过的代码
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <script language="javascript">
    function showDiv(DivID,objTD)
    {
    var oLeft = objTD.offsetLeft;
    var oTop = objTD.parentElement.parentElement.parentElement.offsetTop;
    oTop += objTD.offsetHeight;

    var objDiv = eval(DivID);

    objDiv.style.display = "";
    objDiv.style.left = oLeft;
    objDiv.style.top = oTop;
    }

    function hideDiv(DivID)
    {
    var objDiv = eval(DivID);
    objDiv.style.display = "none";
    }

    function showSelf(objDiv)
    {
    if (objDiv.style.display != "")
    {objDiv.style.display = "";}
    }

    function hideSelf(objDiv)
    {
    if (objDiv.style.display != "none")
    {objDiv.style.display = "none";}
    }
    </script>
    </head><body topMargin="0" leftMargin="0">
        <div id="myDiv" onmouseover="showSelf(this)" onmouseout="hideSelf(this)" style="DISPLAY: none;POSITION: absolute; BACKGROUND-COLOR: #33ff66">
    <table border="0">
    <tr>
    <td>DIV-DIV</td>
    </tr>
    <tr>
    <td>DIV-DIV</td>
    </tr>
    </table>
    </div>
    <table><tr><td>a</td></tr><tr><td>a</td></table>
    <table border="1" cellpadding="0" cellspacing="0" style="POSITION: relative">
    <tr>
    <td onmouseover="showDiv('myDiv',this)" onmouseout="hideDiv('myDiv')">&nbsp;&nbsp;aaaaaa&nbsp;&nbsp;</td>
    <td onmouseover="showDiv('myDiv',this)" onmouseout="hideDiv('myDiv')">&nbsp;&nbsp;bbbbbb&nbsp;&nbsp;</td>
    <td onmouseover="showDiv('myDiv',this)" onmouseout="hideDiv('myDiv')">&nbsp;&nbsp;cccccc&nbsp;&nbsp;</td>
    <td onmouseover="showDiv('myDiv',this)" onmouseout="hideDiv('myDiv')">&nbsp;&nbsp;dddddd&nbsp;&nbsp;</td>
    </tr>
    </table>

    </body></html>
      

  2.   

    to  Pandaxm(郁闷的小猪) 
    getBoundingClientRect()能被哪些版本的浏览器支持呢/
      

  3.   

    kisslan(郁忧的曼陀萝)的代码多行的时候不起作用