Mozilla也没有activeElement的属性当然还得用遍历来实现的,那天写了一个,你看看有没有用<script type="text/javascript"> if (typeof document.activeElement=='undefined') { document.activeElement = null; var x = document.getElementsByTagName('*'); for ( var i = 0 ; i < allTags.length; i++ ) x[i].onfocus = function() { document.activeElement = this;} } function f() { var a = document.activeElement; document.getElementById("demo").innerHTML=(a.id?a.id:a.tagName); } </script>
if (typeof document.activeElement=='undefined')
{
document.activeElement = null;
var x = document.getElementsByTagName('*');
for ( var i = 0 ; i < allTags.length; i++ )
x[i].onfocus = function() { document.activeElement = this;}
}
function f() {
var a = document.activeElement;
document.getElementById("demo").innerHTML=(a.id?a.id:a.tagName);
}
</script>
event.srcElement你应该参考
http://www.mozilla.org/docs/web-developer/