什么是left数值?取得里面td的值用a.innerText

解决方案 »

  1.   

    下面程序仅供参考!<script language="javascript">
    function a(){
    alert(document.all.dee.id);
    }
    </script>
    ...<a name="dee" id="dee"></a>
      

  2.   

    left就是<A id="a">标签距离浏览器左边的距离
      

  3.   

    //得到控件的绝对位置
    function getPos(cell)
    {
        var pos = new Array();
        var t=cell.offsetTop;
        var l=cell.offsetLeft;
        while(cell=cell.offsetParent)
        {
            t+=cell.offsetTop;
            l+=cell.offsetLeft;
        }
        pos[0] = t;
        pos[1] = l;
        return pos;
    }alert(getPos(document.all.a)[0])
    alert(getPos(document.all.a)[1])
      

  4.   

    function GetDefineX(ObjectID)
    {
    var iPositionX=ObjectID.offsetLeft;
    while(ObjectID=ObjectID.offsetParent)
    {
    iPositionX+=ObjectID.offsetLeft;
    }
    return iPositionX;
    }
    function GetDefineY(ObjectID)
    {
    var iPositionY=ObjectID.offsetTop;
    while(ObjectID=ObjectID.offsetParent)
    {
        iPositionY+=ObjectID.offsetTop;
    }
    return iPositionY;
    }