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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onFocus error

Status
Not open for further replies.

Benjer

Programmer
Mar 22, 2002
13
GB
Hi,
Firstly hello as this is my first post. I've just started using javascript and have built a pop up window test for two windows. So have code on 3 pages. The 1st pop up is flash and u click the far right button and then more>> to get the next pop up.
Hopefully my flash detect should work, so i've included a pop up link on my "no flash" page.
Works well. slightly odd when opens 2nd pop up. BUt when i close both i get a javascript error. Any help on any of these issues would be much appreciated.
url of error:

Code:
function FocusMe1()
{
    if(!window.window1){
	}
	else {setTimeout("window1.focus()",10);
	
	}
}
</SCRIPT>
</head>
<body onFocus = &quot;FocusMe1()&quot;

regards
BenG
 
Code:
function FocusMe1() {
 if (window.window1 && !window1.closed)
  setTimeout(&quot;window1.focus()&quot;, 10);
}

I'm not quite sure why, but if you close a window its reference variable is still there. You have to test if it's
Code:
.closed
in order to know if it's been closed.
Code:
- UNIMENT
 
Hi, thanks.
I ended up using a similar test:
function FocusMe1()
{
if(!window.window1){
}
else if(window1.closed){
}
else{setTimeout(&quot;window1.focus()&quot;,10);
}
}
still get a strange debug error on pc... but no actual listing in the debugger.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top