ASPnet web Form Navigation
I want to redirect a new tab and to get focus of the new window when a button is clicked.. I can create a new wind开发者_如何学JAVAow, but can't get its focus even thourh, I tried the following code Window.focus(); How to do this?
My Code: function new_window(url) {
//Open a Window in New tab
var popupwin = null;
popupwin = window.open(url);
popupwin.focus();
self.focus();
//window.focus();
}
I think it would be better not to do this. These are browser preferences and don't try to override those. It may fail due to user settings.
Remove
self.focus();
You can use focus()
method of a form element. This brings mostly the window to front. window.focus()
might implemented different by different browsers.
Do you have html input elements on you popup win?
Try calling focus() on one of the html input elements. This will place the cursor into the element to assist the user start typing there.
精彩评论