JavaScript focus() does not work on IE
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: JavaScript focus() does not work on IE

Threaded View

  1. #1
    Join Date
    Sep 2009
    Posts
    2

    JavaScript focus() does not work on IE

    I have an ASP.NET 2.0 page with a button that opens a popup with FileUpload dialog. The code below is doing that.

    In Chrome and FireFox popup opens and stays in focus, as intended. However, in IE6 and IE7 it opens but then the main window gets in front of it.

    How can I change my JavaScript building code in C# to keep that popup on top in IE7 (our standard browser)?

    Thanks

    /// Javascript Open Popup Window Method
    Code:
    _sb.AppendLine("function openPopup(url) {");           
    _sb.AppendLine("        popup = window.open(url,'FileUpload','height=200,width=420,resizable=yes');");
    _sb.AppendLine("                if (window.focus) {popup.focus()}");            
    _sb.AppendLine("}");            
    _sb.AppendLine(String.Format("openPopup('{0}');", "FileUpload.aspx"));
    Last edited by PeejAvery; September 10th, 2009 at 07:00 PM. Reason: Added code tags.

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center