コメント |
@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
|