Possible Duplicate:
How do I find out which Javascript element has focus?
Is it possible to check in Javascript whether the current window has focus?
Possible Duplicate:
How do I find out which Javascript element has focus?
Is it possible to check in Javascript whether the current window has focus?
No, not really. May be you could assign handlers to the focus/blur events of the window, setting a boolean to true or false and use that to determine if it has focus or not.
Something along this line:
window.hasfocus = false;
window.onfocus = function(){
this.hasfocus = true;
}
window.onblur = function(){
this.hasfocus = false;
}