SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Location
    Philadelphia
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    keeping popup on top -and focus on specific field

    Our site uses popups to handle certain requests (e.g., delete, move or rename a file from a list). So that users do not accidentally "lose" the window --e.g., by accidentally clicking outside it-- before they've finished their request, I'm forcing these popup windows to stay on top. (Of course, there is a convenient "Cancel" button for closing the window if it was opened by mistake.)

    For some it is a simple matter of adding "onBlur="self.focus()" in the body tag. But in other cases the popup already includes an onLoad function that places the focus in the first form field in the window. Adding the "onBlur" above overrides this. Any ideas on how I can force the popup to stay on top yet continue to have the popup open up with focus in a specific field/element?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haven't tested it, but try...
    Code:
    <html>
    <head>
    <script>
    window.onload = function()
    {
      window.onblur = window.focus;
      // focus first form field here
    }
    </script>
    </head>
    <body>
    
    ...
    
    </body>
    </html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •