[thelist] Bringing windows to the foreground with javascript

Dwayne Holmberg dholmberg at media-logic.net
Thu, 20 Jan 2000 14:51:43 -0700 (MST)


I'm not a javascript guru, but I was having the same problem a couple days ago, not being able to bring the window I wanted to the front. Finally solved it by putting in a half second delay before calling focus().


/* with apologies to jeff howden,
   whose code is mangled below */

function openWin(wName,wWidth,wHeight,wResize) {
	features = 'menubar=1,toolbar=1,location=0,'
		+ 'directories=0,scrollbars=1,status=1,'
		+ 'resizable=' + ((wResize) ? 1 : 0)
		+ ((wWidth) ? ',width=' + wWidth : '')
		+ ((wHeight) ? ',height=' + wHeight : '');
	 popWin = window.open('',wName,features);

	setTimeout("moveFocus()", 500);

	return true;
}

function moveFocus() {
	popWin.focus();
}


- dwayne