多段ポップアップjs

2009.03.08

ポップアップウィンドウからポップアップウィンドウを表示する場合、別々のfanction、ウィンドウ名を指定する。

■一段目のjs

function <span style="color: #ff0000;">windowPopup</span>(filename, width,height){
if(window.out && window.comment){out();}
w=width;
if(!document.layers&&navigator.userAgent.indexOf(’Win’)>=0){w+=18;}
h=height+18;
if(screen.availWidth<w ){w=screen.availWidth;};
if(screen.availHeight<h+100){h=screen.availHeight-100};
popWin=window.open(filename,’<span style="color: #ff0000;">popup</span>‘,’width=’+w+’,height=’+h+’,
toolbar=0,menubar=0,status=1,location=0,resizable=1,scrollbars=1′);
}

▼一段目のソース

<a href="javascript:windowPopup(’infor/gameshow/index.html’,645,940);”>一段目</a>

引き続きポップアップした画面からさらにポップアップ画面のオープン

■二段目のjs

function <span style="color: #ff0000;">windowPopup2</span>(filename,width,height){
if(window.out && window.comment){out();}
w=width;
if(!document.layers&&navigator.userAgent.indexOf(’Win’)>=0){w+=18;}
h=height+18;
if(screen.availWidth<w ){w=screen.availWidth;};
if(screen.availHeight<h+100){h=screen.availHeight-100};
popWin=window.open(filename,’<span style="color: #ff0000;">popup2</span>‘,’width=’+w+’,height=’+h+’,
toolbar=0,menubar=0,status=1,location=0,resizable=1,scrollbars=1′);
}

▼二段目のソース

<a href="javascript:windowPopup2(’infor/gameshow/index.html’,645,940);”>一段目</a>

起動するウィンドウ名を変更することにより多段ポップアップが実現できる。

Tags:

コメントは受け付けていません。