用srcElement试试
<script>
function showid()
{
alert(event.srcElement.id);
}
document.onclick=showid;
</script>
<body id=mybody>
<form name=form1 action=myasp.asp>
<table id=mytable><tr id=mytr><td id=mytd>123</td></tr></table>
<input id=mytext>
<input id=mybutton type=button>
</form>
</body>

解决方案 »

  1.   

    用srcElement不行,比如说我有一个table,table里还有别的对象,我的条件是只要点到table的范围(大范围)就执行一个操作,但是如果我点在table中的其它对象(小范围)的时候我就得到不table的id,那么我的条件就满足不了了。
      

  2.   

    原来是activeElement对onmousedown捕获不准确,知道该怎么做了。
      

  3.   

    没问题啊,你自己试试?<body onclick=alert(document.activeElement.tagName)>
    <div style="width:200;height:200;background-color:red"></div>
    </body>
      

  4.   

    Retrieves the object that has the focus when the parent document has focus.Syntax[ oActive = ] document.activeElement好象是说,在父document focus 的时候,当前 focus 的对象.有个 setActive() 方法,不过需要 IE 5.5 支持