如何获取当前鼠标下的标签,前提是鼠标在那不动 我根据另一个 例如时间事件 在第5秒 获取这个标签
谁有思路 或者怎么写能达到目的 鼠标悬停什么的就算了 悬停的话 如果不动是不触发事件的

解决方案 »

  1.   

    给LZ个思路,下面例子IE6测试通过
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>test</title>
    <script>
    var currentObj = null;
    document.onmouseover=function(){
    currentObj = event.srcElement;
    };
    window.onload = function(){
    window.setInterval("showCurrentObj()",5000);
    }
    function showCurrentObj(){
    alert(currentObj.outerHTML);
    }
    </script>
    </head><body>
    <div id=d1 style="background-color:red">111</div>
    <div id=d2 style="background-color:green">222</div>
    <div id=d3 style="background-color:yellow">333</div>
    <div id=d4 style="background-color:blue">444</div>
    </body></html>
      

  2.   

    currentObj = event.srcElement;
      

  3.   

    currentObj = event.srcElement;关键是srcElement