首先获取事件对象e事件来源IE下面对应srcElementFF下面target下面简单例子兼容IE和FireFox function init() { document.body.onmousemove = function(e) { if (!e) { e = window.event; } else { e.srcElement = e.target; } document.getElementById("divDebug").innerHTML = "mousemove (" + e.clientX + "," + e.clientY + ") srcElement=" + e.srcElement.tagName + "[" + e.srcElement.id + "]"; }; } div span
link