開くサブウィンドウの種類

次のボタンでサブウィンドウが開く。

<SCRIPT language="JavaScript"><!--
function NewWindow1(){ //空白ページを開く
window.open('','win1','width=500,height=300,left=100,top=200');
}

function NewWindow2(){ //新規作成のページを開く
newW2 = window.open('','win2','width=500,height=300,left=100,top=200');
newW2.document.write("<H3>別ウィンドウに新規ページを作成</H3><HR>");
newW2.document.write("<P>(1)urlを指定しないでwindow.openする<BR>(2)document.writeでHTMLを記述<br>(3)document.closeで記述を停止する。</P>"); newW2.document.bgColor = "black"; //背景色は黒に
newW2.document.fgColor = "white"; //文字色を白に
newW2.document.close();
}

function NewWindow3(){ //既存のhtmlファイルを開く
window.open('../aaa/start.htm','win3','width=500,height=300,left=100,top=200');
}

function NewWindow4(){ //画像ファイルを開く
window.open('../../java/jadata/ban_138.gif','win4','width=500,height=200,left=100,top=200');
}
//--></SCRIPT>
</head>

<body>
<button onclick="NewWindow1();">空白のページ</button>
<button onclick="NewWindow2();">新規作成のページ</button>
<button onclick="NewWindow3();">既存のページ</button>
<button onclick="NewWindow4();">画像ファイルを開く</button>

 

end(01/05/21 )