problem with window.close()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Nadoll

    problem with window.close()

    Hello,

    i want to close a popup-window with the onBlur eventHandler.

    function closeIt() {
    setTimeout('win dow.close()',20 00); }

    <body onBlur="closeIt ()">
    html
    </body>

    Problem:
    There is a form on my page, and when a input-field gets focus, body looses
    focus and the window closes.
    That's not what i want. I want to close the window, if focus goes to another
    window or application, but not when someone tries to fill that form.

    Any idea for me?
    Thanks a lot,
    Martin Nadoll


  • L. 'Perfect' Gordon

    #2
    Re: problem with window.close()

    In your closeIt() function, capture event.clientX and event.clientY, and
    check if the mouse coordinates are within the window's coordinates and
    then close it if appropriate.

    I hope this is helpful.
    --
    *************** *************** ******
    MUSIC24SEVEN
    Pioneers of the
    'Digital Entertainment Industry'

    *************** *************** ******
    "Martin Nadoll" <martin@nadoll. de> wrote in message
    news:bqpna2$8fk $03$1@news.t-online.com...[color=blue]
    > Hello,
    >
    > i want to close a popup-window with the onBlur eventHandler.
    >
    > function closeIt() {
    > setTimeout('win dow.close()',20 00); }
    >
    > <body onBlur="closeIt ()">
    > html
    > </body>
    >
    > Problem:
    > There is a form on my page, and when a input-field gets focus, body looses
    > focus and the window closes.
    > That's not what i want. I want to close the window, if focus goes to[/color]
    another[color=blue]
    > window or application, but not when someone tries to fill that form.
    >
    > Any idea for me?
    > Thanks a lot,
    > Martin Nadoll
    >
    >[/color]


    Comment

    • Dima Karelich

      #3
      Re: problem with window.close()


      "Martin Nadoll" <martin@nadoll. de> wrote in message
      news:bqpna2$8fk $03$1@news.t-online.com...[color=blue]
      > Hello,
      >
      > i want to close a popup-window with the onBlur eventHandler.
      >
      > function closeIt() {
      > setTimeout('win dow.close()',20 00); }
      >
      > <body onBlur="closeIt ()">
      > html
      > </body>
      >
      > Problem:
      > There is a form on my page, and when a input-field gets focus, body looses
      > focus and the window closes.
      > That's not what i want. I want to close the window, if focus goes to[/color]
      another[color=blue]
      > window or application, but not when someone tries to fill that form.
      >
      > Any idea for me?
      > Thanks a lot,
      > Martin Nadoll
      >
      >[/color]

      Use onFocus event in your main window.
      If you opened your pop-up window with newWin = window.open(... ..) then
      in the main window use
      <body onFocus="newWin .close()">
      Wnen pop-up looses focus the main window gets it - this is my idea how to
      fix the problem.
      All the best,
      Gennadiy






      Comment

      Working...