「JavaScript」window.open メソッドで別ウィンドウを開くサンプル

書式
var window = window.open(url, windowName, [windowFeatures]);
引数
1.url
DOMString で、読み込むリソースの URL を示します。

2.windowName
DOMString で、指定したリソースを読み込むための閲覧コンテキスト (ウィンドウ、 <iframe>、タブ) の名前を指定します。

3.windowFeatures
DOMString で、ウィンドウ特性とそれに対応する値を “name=value" の形式で指定したもののカンマで区切りのリストです。

使用例1

var cft;
var wft = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";

function openRequestedPopup() {
  cft = window.open("http://www.abc.com/", "ABC_WindowName", wft);
}

使用例2

<div class="cftRight">
 <input onclick="window.open('xxx');" type="button" value="表示" name="infoshow">
</div>

 

JavaScript

Posted by arkgame