打开新窗口,并使用JavaScript进行超链接控制以获取焦点. [英] Open New window and get focus using javascript for hyperlink control.
问题描述
当我使用Target ="_blank"属性单击超链接控件时,我想打开一个新窗口,新窗口将被聚焦.
它适用于Google和其他网站,我也可以处理自己的Pages来集中注意力,例如< bodyönload="this.focus();">
但是对于http://yahoo.co.in,它在新窗口中打开,但在父窗口后面打开.
请帮助我如何用javascript编写代码以集中精力.
感谢&问候
Sudhakar
Hi,
I want to open a new window when i click on hyperlink control by using Target = "_blank" property and the new window will be get focused.
It works for Google and other websites and i also handle my own Pages to get focused like <body önload="this.focus();">
But for the http://yahoo.co.in its opened in the new window but it opens behind the parent window.
Please help me how to write a code in javascript to get focused.
Thanks & Regards
Sudhakar
推荐答案
大家好,
终于找到了解决方案.
通过将focus()作为函数调用SetTimeOut()方法将解决此问题.
我的代码就像:
函数setFocus(){
var grid;
grid = igtbl_getGridById(''<%= OfflineReports.ClientID%>'');
var actRow = igtbl_getActiveRow(''<%= OfflineReports.ClientID%>''));
var hypId = actRow.Id;
var hypctrl = document.getElementById(hypId);
var hlkurl = hypctrl.all;
if(hlkurl!= null){
var url = hlkurl [4];
var win = window.open(url);
setTimeout(function(){win.focus();},1000);
}
}
在这里,我使用了超网格,您可以使用Document.GetElementById(<%hypLink.ClientID%>");
Hi,All
At last i found the solution for this.
Calling The SetTimeOut() method passing focus() as a function will solve the issue.
My Code Is Like:
function setFocus() {
var grid;
grid = igtbl_getGridById(''<%=OfflineReports.ClientID%>'');
var actRow = igtbl_getActiveRow(''<%=OfflineReports.ClientID%>'');
var hypId = actRow.Id;
var hypctrl = document.getElementById(hypId);
var hlkurl = hypctrl.all;
if (hlkurl != null) {
var url = hlkurl[4];
var win = window.open(url);
setTimeout(function() { win.focus(); }, 1000);
}
}
Here i used ultra grid instead you can use Document.GetElementById("<%hypLink.ClientID%>");
Hi,All
At last i found the solution for this.
Calling The SetTimeOut() method passing focus() as a function will solve the issue.
My Code Is Like:
function setFocus() {
var grid;
grid = igtbl_getGridById('<%=OfflineReports.ClientID%>');
var actRow = igtbl_getActiveRow('<%=OfflineReports.ClientID%>');
var hypId = actRow.Id;
var hypctrl = document.getElementById(hypId);
var hlkurl = hypctrl.all;
if (hlkurl != null) {
var url = hlkurl[4];
var win = window.open(url);
setTimeout(function() { win.focus(); }, 1000);
}
}
Here i used ultra grid instead you can use Document.GetElementById("<%hypLink.ClientID%>");
Improve solution Permalink | Posted
这篇关于打开新窗口,并使用JavaScript进行超链接控制以获取焦点.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!