Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing windows opened with javascript

Status
Not open for further replies.

Assimilate

Technical User
Oct 7, 2001
33
GB
Hello everyone, i have a coding problem that is really annoying.

I have written the following code to open a window :
<A HREF = &quot;#&quot; onClick=&quot;window.open('babyout.avi','myWin','status,scrollbars,width=400,height=550');return false&quot;> <IMG BORDER = &quot;0&quot; SRC =&quot;previewteaser1.jpg&quot;> </A>

the only problem is that once this window is open, and i then open another window infront of it, and i then click on the link which opened the javascript window, the javascript window doesnt return to the front.

How do i get the focus on the javascript window once it has been taken of??

Thanks
 
try this:

<script language=&quot;javascript&quot;>

function openMyWin(){
try{
myWin.focus();
}
catch(errorObj){

myWin = window.open('babyout.avi','myWin','status,scrollbars,width=400,height=550');
myWin.focus();
}


and then

<A HREF = &quot;#&quot; onClick=&quot;openMyWin()&quot;> <IMG BORDER = &quot;0&quot; SRC =&quot;previewteaser1.jpg&quot;> </....

you could pass window parameters into the openMyWin function as well..

hope this helps/works.

cheyney
 
Add this:
[tt]myWin.focus();[/tt]
between &quot;window.open()&quot; and &quot;return false&quot; statements.

Also, why don't you search this forum before asking? There quetions are discused many times.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top