javascript - window.onblur event also triggers window.onfocus event when using IE8 -


both events getting fired @ time onblur event.

<%@ 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> 

finally got solved. thank help!

$(window).bind("load", function() {         pageload();     });      var activeelement;      function pageload() {         activeelement = document.activeelement;         document.onfocusout = logwindow;     }      function logwindow() {         if (activeelement != document.activeelement) {             activeelement = document.activeelement;         }         else {             $('#msg').html($('#msg').html()+'<br/> focus');         }      } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -