想做一个鼠标放在anchor上,弹出一个提示窗口的,提示窗口不想在鼠标的位置,想让它在链接的最右边<a href="#" onmouseover="selStation(this);"function selStation(e) {
e.style.right.x这样不行,

解决方案 »

  1.   

    r t=document.getElementById(\"_hidName\").offsetTop;
    var l=document.getElementById(\"_hidName\").offsetLeft;var obj=event.srcElement;
    alert("坐标为:x="+obj.style.left+",y="+obj.style.top) 
      

  2.   

    楼主想要的位置=e.offsetLeft+e.offsetWidth
      

  3.   

    其实我也找到这种方法了,但还是有点挡住,我上网搜了,主要是有body的padding呀margin之类的,实在搞不懂,试了好多都不行
      

  4.   

    自己写个兼容的,或者直接使用jquery的offsetleft(),和width()方法
      

  5.   

    getOffset:function (el, isLeft) {
    var  retValue  = 0 ;
    while  (el != null ) {
    retValue  +=  el["offset" + (isLeft ? "Left" : "Top" )];
    el = el.offsetParent;
    }
    return  retValue;
    }
    discuz使用的方法~