adityaiiii
asked on
IE - Window.Focus - Strange Problem
Hello All
I'm having very strange problems with window focus in internet explorer.
1. I've my default.aspx and in that I'm opening a new asp page called Edi.aspx using
Dim jscriptStr As String
jscriptStr = "<script language=JavaScript> window.open('Edi.aspx','ed itorWin',' height=5,w idth=555,l eft=300,to p=300,tool bar=0,loca tion=0, directories=0,status=0,men ubar=0,scr ollbars=no ,resizable =0,titleba r=no');</s cript>"
RegisterClientScriptBlock( "clientScr ipt", jscriptStr)
In the Edi.aspx body tag I'm putting onload="javascript:top.foc us();".
This is not working and the Edi.aspx is hiding behind the default.aspx. why is this happening? At the same time when I used this technique for a opening different page other.aspx its working.
Another big thing is- the above technique is working perfectly fine in firefox browser for both Edi.aspx and other.aspx.
I'm using IE.6.0.
2. Is there any way to access the controls in Edi.aspx from the default.aspx ( here Edi.aspx is opened from the default.aspx using window.open('Edi.aspx'))?
Thanks for your help
Aditya
I'm having very strange problems with window focus in internet explorer.
1. I've my default.aspx and in that I'm opening a new asp page called Edi.aspx using
Dim jscriptStr As String
jscriptStr = "<script language=JavaScript> window.open('Edi.aspx','ed
RegisterClientScriptBlock(
In the Edi.aspx body tag I'm putting onload="javascript:top.foc
This is not working and the Edi.aspx is hiding behind the default.aspx. why is this happening? At the same time when I used this technique for a opening different page other.aspx its working.
Another big thing is- the above technique is working perfectly fine in firefox browser for both Edi.aspx and other.aspx.
I'm using IE.6.0.
2. Is there any way to access the controls in Edi.aspx from the default.aspx ( here Edi.aspx is opened from the default.aspx using window.open('Edi.aspx'))?
Thanks for your help
Aditya
ASKER
Hello pravina
Do you know anything about the problem 1.? also can you please expand the above answer more ?
Thanks
Aditya
Do you know anything about the problem 1.? also can you please expand the above answer more ?
Thanks
Aditya
1. If window has been opened by window.open , it's parent window
can be accessed by
window.opener
to focus on the parent window, you can use window.opener.focus() ;
can be accessed by
window.opener
to focus on the parent window, you can use window.opener.focus() ;
ASKER
I know that pravina. Here Its the other way around. I want to access the controls in the new window from parent window. Is there any method for that ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello
I need to access child from parent. I know how to access a parent window from child window. Please tell me how to access Web controls in child window from parent window where child window is opened from parent window using window.open.
I need to access child from parent. I know how to access a parent window from child window. Please tell me how to access Web controls in child window from parent window where child window is opened from parent window using window.open.
ASKER
One more thing, the webcontrols in the child page are ASP controls
You can try doing this:
<script>
var newWin = window.open("index.aspx");
if(newWin!=null)
{
//this will get you the background color of the new window in the old window
alert(newWin.document.bgCo lor);
}
</script>
Warning: If you try to open a page in a different domain than the one on which your site is hosted, then you will get an exception in Javascript.
<script>
var newWin = window.open("index.aspx");
if(newWin!=null)
{
//this will get you the background color of the new window in the old window
alert(newWin.document.bgCo
}
</script>
Warning: If you try to open a page in a different domain than the one on which your site is hosted, then you will get an exception in Javascript.
>>I need to access child from parent.
I know how to access a parent window from child window. Please tell me how to access Web controls in child window >>from parent window where child window is opened from parent window using window.open.
Did you read my post completely ???
Did you look at the code
function GetChildsTag (tagId) {
if (!nw) { return; }
alert (nw.document.getElementByI d(tagId).i nnerHTML);
}
That gets the elements from child window .
I said earlier that I am posting a comprehensive example how to get the parent window and child window.
Good Luck to You.
_PA
I know how to access a parent window from child window. Please tell me how to access Web controls in child window >>from parent window where child window is opened from parent window using window.open.
Did you read my post completely ???
Did you look at the code
function GetChildsTag (tagId) {
if (!nw) { return; }
alert (nw.document.getElementByI
}
That gets the elements from child window .
I said earlier that I am posting a comprehensive example how to get the parent window and child window.
Good Luck to You.
_PA
var nw = window.open('Edi.aspx','ed
alert ('Access Document Object ' + nw.document);