PDA

View Full Version : for each window a focus!


paolaban
01-09-2003, 02:47 PM
I have an html page (1.htm). Inside a swf (1.swf); 1.swf is a game and i need the focus on it when it opens the 1.htm window. To get the focus i use this js:

<script language="JavaScript">
<!--
function fuoco(){
var IE = navigator.appName.indexOf("Microsoft") != -1;
var filmato = IE ? window.filmato : window.document.filmato;
filmato.focus();
}
//-->
</script>

In the body tag:onLoad="fuoco()" and in the object tag the right parameters (Id, name ecc..)

When i click a buttom in 1.swf, a new window openes (2.htm).
To overlap 1.htm with the new one (2.htm) i put in the 2.htm body tag: onLoad="self.focus()".
Now the problem is that, if I want to see the old one page (1.htm) that now is under the 2.htm, and i press its window-bar, I lost the focus on the 1.swf...
How can I get a focus that pass trought one page to another?

Algorithm
01-09-2003, 10:12 PM
Try adding this after your function declaration in the script tag of 1.htm:

window.onfocus = fuoco;

paolaban
01-09-2003, 11:52 PM
I try but it doesn'work....
Somebody told me to think about parent and child window... I'm not using frameset. Do you think it could be a solution?
The problem is that i don't understand so much about js...