Internet Explorer has a handy 'activeElement' property on the
document object which keeps track of the current element that has
focus. Firefox 3 is going to support the same property inline with the
HTML 5 specification but that's a fair way off so here's a work around:
function onElementFocused(e)
{
if (e && e.target)
document.activeElement =
e.target == document ? null : e.target;
}
if (document.addEventListener)
document.addEventListener("focus", onElementFocused, true);
All we do here is assign a handler to the focus event of the document. Our handler updates the activeElement property.
Just place that in your global javascript code and you've got activeElement support in mozilla!
Jimmy