javascript

格納型メニュー

<head>
<script type=&quot;text/javascript”>

function ONOFF (id) {
ANS=document. getElementById(id);
switch (ANSWER.style.display) {
case “none” :
ANS.style.display=&quot;block”;
break;
case “block” :
ANS.style.display=&quot;none”;
break;
}
}

<head>
<html>
<div class=&quot;question” onClick=&quot;javascript:ONOFF(’install-006′)” onKeypress=&quot;javascript:ONOFF(’install-006′)”>
表示部分

</div>
<div id=&quot;install-006″ class=&quot;answer” style=&quot;display:none;” onClick=&quot;javascript:ONOFF(’install-006′)” onKeypress=&quot;javascript:ONOFF(’install-006′)”>
格納表示部分

</div>
</html></head></script></head>

多段ポップアップjs

ポップアップウィンドウからポップアップウィンドウを表示する場合、別々の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>

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