[thelist] JavaScript: focus on another window

jeff jeff at members.evolt.org
Wed Dec 13 18:25:07 CST 2000


tab,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Tab Alleman
:
: well, I don't know if there are other ways, but this did the trick:
:
: 	function FullScreen(url)
: 		{
: 		var fs = window.open(url, 'B', 'resizable');
: 		fs.focus();
: 		return true;
: 		}
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

notice how you're focusing it in your function.  you're aware that the
window is assigned to a variables, in this case "fs".  so, you'd need to
call it like that again to access it and it's properties and methods.
however, since the variable is defined as a variable that's local to the
function you have no way of accessing it outside of the function.  you'll
have to make that variable a global variable for it to be accessible.

var fs = null;

function FullScreen(url)
{
  fs = window.open(url, 'B', 'resizable');
  fs.focus();
  return true;
}

function focusFullscreen()
{
  if(fs != null && fs.open && fs.focus)
    fs.focus();
}

good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org





More information about the thelist mailing list