<SCRIPT LANGUAGE="JavaScript">
<!--
function cc()
{
var r = document.all.aa.getBoundingClientRect ();
alert(r.top + ":" + r.left + ":" + r.bottom + ":" + r.right);
}
//-->
</SCRIPT>
<div style="position:absolute;left:100px;top:200px;width:100px;height:200px;border:1px solid red" id=aa></div>
<input type=button onclick="cc()" value="tt">

解决方案 »

  1.   

    <br><br>&nbsp; &nbsp; <input onfocus="mm(this)">focus me
    <iframe frameborder=0 width=200 height=200 name=MzIframe id="MzIframe"
      style="display: none; position: absolute; z-index: 2"></iframe>
    <SCRIPT LANGUAGE="JavaScript">
    function getAbsPoint(e)
    {
      var x = e.offsetLeft, y = e.offsetTop;
      while(e=e.offsetParent){x += e.offsetLeft; y += e.offsetTop;}
      return {"x": x, "y": y};
    }
    function mm(e)
    {
      window.frames["MzIframe"].location.href = "http://community.csdn.net/Expert/topic/3820/3820249.xml?temp=.205456";
      var iframe = document.getElementById("MzIframe");
      var xy = getAbsPoint(e);
      iframe.style.top = xy.y + e.offsetHeight;
      iframe.style.left= xy.x;
      iframe.style.display = "";
    }
    </SCRIPT>