focusメソッド


書式:
WindowObject.focus()
focus()
window.focus()

解説:
WindowObjectで指定したウィンドウにフォーカスを移します.

使用例:
<script language="JavaScript">
<!--
var cnt = 0;
var timerID;
w = window.open( "../serch.html" , "" , "width=200,height=150");
function ChngFocus(){
	if( w.closed || closed ){
		clearTimeout( timerID );	
		return;
	}
	if( cnt == 1 ){
		window.focus();
	}
	else{
		w.focus();
	}
	cnt ^= 1;
	timerID = setTimeout( "ChngFocus()" , 500 );
}
//-->
</script>

<form>
<input type=button value="Change Focus" onclick="ChngFocus()">
</form>


(C)Copyright 1998 Motonari Morikawa. All rigthts reserved.