<script type='text/javascript'>
var Focused
var AllElts=new Array()
function TrackFocus(){
AllElts=document.getElementsByTagName('*')
for (i=0;i<AllElts.length;i++){AllElts[i].Foo='tag ' +i+' has got focus'
AllElts[i].setAttribute('onfocus',function(){Focused=this.Foo;alert(Focused)})
AllElts[i].onfocus=function(){Focused=this.Foo;alert(Focused);}
}
}
Sprawdza który element ma ustawiony focus

Nie wiem czy działa, znalazłem to na necie.
EDIT:
<script type="text/javascript"> var elName;
window.onload=function()
{
var el = document.forms[0].elements;
for(var i=0;i<el.length;i++)
el[i].onfocus=function()
{
elName=this.getAttribute('name');
}
}
<a href="#" onclick="alert(elName?'The element having the name of ''+elName+'' was focused.':'No element was focused.'); return false">"Which element has the focus?"
</a><br> <input name="mytxt1" type="text"><br> <input name="mytxt2" type="text"><br> <input name="mytxt3" type="text"><br> <input name="mytxt4" type="text"><br> <input name="mytxt5" type="text"><br>
elName zawiera nazwę focusowanego elementu, więc if(elName=='nazwa') { alert('yes'); }