ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文

  メンテナンス 前画面に戻る

対象スレッド 件名: window.open で開く場合
名前: lightbox
処理選択
パスワード

件名 window.open で開く場合
名前 lightbox
コメント
@SHOW
window.open で開く場合は、その時に新しいウインドウのオブジェクトを取得できます。

さらに、新しいウインドウの見栄えもコントロールできます。
( タブブラウザでも、新しいウインドウが開きます )
@END

@HTML
<script type="text/javascript">

function focusAction() {
	try {
		if ( !window.closed ) {
			console.log( "focusAction1" );
			openObject.blur();
			setTimeout( function() {
				try {
					openObject.focus();  
				}
				catch( e ) {
				}
			}, 100 );
			console.log( "focusAction2" );
		}
	}
	catch( e ) {
	}
}
window.onfocus = focusAction
window.onactivate = focusAction

</script>
▼ textField2
<input type="text" name="textField2"> : <input
	type="button"
	onclick='
		openObject = window.open(
			"html/win_control_02.htm",
			null,
			"height=400"+
			",width=400"+
			",status=yes"+
			",toolbar=no"+
			",menubar=no"+
			",location=no"+
			",top=0"+
			",left="+(screen.width-400-20)
		);
	'
	value="新しいウインドウを開く"
> : <input type="button" value="閉じる" onclick='closeWindow();'>
@HEND

@DIV
<input
	type="button"
	onclick='
		@C:red(openObject) = window.open(
			"html/win_control_02.htm",
			null,
			"height=400"+
			",width=400"+
			",status=yes"+
			",toolbar=no"+
			",menubar=no"+
			",location=no"+
			",top=0"+
			",left="+(screen.width-400-20)
		);
	'
	value="新しいウインドウを開く"
> : <input type="button" value="閉じる" onClick="closeWindow();">
@END


  [[開いたウインドウの記述]]
@DIV
// *********************************************************
// このウインドウを開いたウインドウにアクセス
// *********************************************************
function doAction( strValue ) {

	var opener = window.opener;

	opener.document.getElementsByName("textField2")[0].value = "データをセット";

}
@END