-
September 10th, 2009, 12:56 PM
#1
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.
-
September 10th, 2009, 07:02 PM
#2
Re: JavaScript focus() does not work on IE
I would make it so that the popup receives focus regardless of the other windows focus.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 10th, 2009, 09:26 PM
#3
Re: JavaScript focus() does not work on IE
here is working solution (in the popup window):
<body onload="setTimeout('self.focus()', 10)">
thanks
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|