window blur event in ie when focus isn't lost

Discussion in 'Javascript' started by nutso fasst, Oct 13, 2006.

  1. nutso fasst

    nutso fasst Guest

    Perhaps this will be useful to someone...

    I have a page with a document.onkeypress handler that uses
    window.onblur/onfocus events to stop/start an interval timer. In IE 5,
    clicking on a DIV with CSS 'position: absolute' fires a window.onblur event.
    Subsequently clicking outside the DIV won't fire the window.onfocus event.
    If I switch to another window and then back to the window in question, the
    onfocus event fires, but the onblur event fires immediately after.
    Consequently, neither the interval timer nor the keypress handler will
    restart without a page reload.

    The fix for this is to add an onfocus handler to the DIV element:

    <div onfocus="this.blur()">

    The likelyhood of someone accidently clicking on the DIV may be low, but
    folks do sometimes click a visible portion of a window to give it focus and
    I don't want any of them getting frustrated.

    nf
     
    nutso fasst, Oct 13, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lazar

    popup window blur event

    lazar, Jul 19, 2005, in forum: Javascript
    Replies:
    2
    Views:
    220
    lazar
    Jul 20, 2005
  2. Replies:
    0
    Views:
    137
  3. Replies:
    0
    Views:
    112
  4. Replies:
    3
    Views:
    157
  5. Roger
    Replies:
    3
    Views:
    336
Loading...

Share This Page