[js]
var CurrentActive;
window.onfocus = function() {
CurrentActive = true;
document.body.innerHTML +="当前窗口被激活
";
}
window.onblur = function() {
CurrentActive = false;
document.body.innerHTML += "当前窗口没有激活
";
}
jquery 下如何获取当前窗口被激活
$(window).focus(function() {
//处于激活状态
});
$(window).blur(function() {
//处于未激活状态
});
[/js]