ポップアップウィンドウ(親ウィンドウ操作)
1.新規ウィンドウを画面センターポップアップ。
2.開きもとの親ウィンドウを子ウィンドウから操作
3.親ウインドウが閉じられた場合、新規にウィンドウを開く
SAMPLE01(normal ver.)
<script language="JavaScript">
function WinPopup() {
popup_left=(window.screen.width/2)-(AAA/2+10);
popup_top=(window.screen.height/2)-(BBB/2+50);
var win1 = window.open('index_popup.html','name','toolbar=no,location=no,status=no,menubar=no,scrollbars=0,resizable=no,width=AAA,height=BBB,left='+popup_left+',top='+popup_top+',screenX='+popup_left+',screenY='+popup_top);
win1.focus();
}
</script>
SAMPLE02(parent window ver.)
<script language="JavaScript">
function WinPopup() {
popup_left=(window.screen.width/2)-(AAA/2+10);
popup_top=(window.screen.height/2)-(BBB/2+50);
window.open('index_popup.html','name','toolbar=no,location=no,status=no,menubar=no,scrollbars=0,resizable=no,width=AAA,height=BBB,left='+popup_left+',top='+popup_top+',screenX='+popup_left+',screenY='+popup_top);
window.self.name="Win_main";
location.href= "https://www.ken-g.com/";
}
</script>
under script is in child window
<script language="JavaScript" type="text/javascript">
<!--
function openerJump(url) {
app = navigator.appName.charAt(0);
if ((navigator.appVersion.indexOf('Win',0) != -1) && (app == "M")) {
if ( !window.opener.closed ) {
opener.self.location.href=url;
window.opener.blur();
} else {
window.open(url,"Win_main","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
window.self.focus();
}
} else {
if ( openerSur() == true ) {
top.opener.top.location.href=url;
window.top.opener.blur();
} else {
window.open(url,"Win_main","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
window.self.focus();
}
}
}
function openerSur() {
var ua = navigator.userAgent;
if( !!window.top.opener ) {
if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) {
return !window.top.opener.closed;
} else {
return typeof window.top.opener.document == 'object';
}
} else {
return false
}
}
//-->
</script>