functon getDim(element)
{
  for (var leftX=0,leftY=0; element!=null; )
  {
    leftX += element.offsetLeft;
    leftY += element.offsetTop;
    element = element.offsetParent;
  }  return {x:leftX, y:leftY}
}用上面这个函数就可以获取对象左上角的绝对位置,只要配合对象的width和height就可以相应得到右下角的绝对坐标了!

解决方案 »

  1.   

    var tdA = getDim(document.all.a);
    tdA.rightBottomX = tdA.x + document.all.a.width;
    tdA.rightBottomY = tdA.y + document.all.a.width;
      

  2.   

    function getObjectLeft(e)
    {
      var l=e.offsetLeft; while(e=e.offsetParent) l += e.offsetLeft; return l;
    }function getObjectTop(e)
    {
      var t=e.offsetTop;  while(e=e.offsetParent) t += e.offsetTop;  return t;
    }
    ... ...
      

  3.   

    呵呵,高手呀
    <html xmlns:v="urn:schemas-microsoft-com:vml">
    <title>网页中的斜线表格</title>
    <style>
    v\:* {Behavior: url(#default#VML);}
    body {margin: 0px; font-size: 12px;}
    </style>
    <body>
    <table width="200" cellspacing="1" cellpadding="5" bgcolor="black" style="position:absolute;left:0;top:0;">
    <tr bgcolor="white"><td> &nbsp;</td><td>&nbsp; </td></tr>
    <tr bgcolor="white"><td>&nbsp; </td><td> &nbsp;</td></tr>
    </table>
    <v:line from="0,0" to="100,28" style="position:relative;"/>
    <div style="position:absolute;left:60;top:4;">月度</div>
    <div style="position:absolute;left:2;top:15;">销售量</div>
    </html>
      

  4.   

    实践证明不行,下面的例子运行结果不对,只有把表格设置position:relative才有可能,实际操作的时候很麻烦
    <html xmlns:v="urn:schemas-microsoft-com:vml">
    <title>网页中的斜线表格</title>
    <style>
    v\:* {Behavior: url(#default#VML);}
    body {margin: 0px; font-size: 12px;}
    </style>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function getObjectLeft(e)
    {
      var l=e.offsetLeft; while(e=e.offsetParent) l += e.offsetLeft; return l;
    }
    function getObjectTop(e)
    {
      var t=e.offsetTop;  while(e=e.offsetParent) t += e.offsetTop;  return t;
    }
    window.onload=function()
    {
    var line1 = document.all["line1"];
    var td1 = document.all["td1"];
    alert(td1.style.height); 
    line1.from = getObjectLeft(td1) +"," + getObjectTop(td1);
    line1.to = getObjectLeft(td1)+td1.style.width +"," + getObjectTop(td1)+td1.style.height;
    }
    //-->
    </SCRIPT>
    <body>
    <BR><BR><BR><BR><BR>
    <table width="200" cellspacing="1" cellpadding="5" bgcolor="black" id="table1">
    <tr bgcolor="white"><td id="td1" style="width:50;height: 30;"></td><td></td></tr>
    <tr bgcolor="white"><td>&nbsp; </td><td> &nbsp;</td></tr>
    <tr bgcolor="white"><td>&nbsp; </td><td> &nbsp;</td></tr>
    </table>
    <v:line  style="position:relative;" id="line1"/>
    </html>
      

  5.   

    这种问题,翻开dhtml手册,自己找答案我不是懒我是告诉你一个学习js,dhtml的途径。去下载一个dhtml手册