onblur 이벤트가 발생할 때 두 이벤트가 모두 발생합니다.window.onblur 이벤트는 IE8을 사용할 때 window.onfocus 이벤트도 트리거합니다.
<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication1.WebForm1" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="js/jquery-1.7.2.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
window.onfocus = function() {
$('#msg').html($('#msg').html() + '<br/> focus');
};
window.onblur = function() {
$('#msg').html($('#msg').html() + '<br/> Blur');
};
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="msg">
</div>
</asp:Content>
문제를 복제하는 jsfiddle을 만들 수 있습니까? –
_window_ 대신 _document.body_에 _focus_ 및 _blur_ 이벤트를 등록하십시오. –
@AshBurlaczenko http://jsfiddle.net/e2XBt/ – AshokD