javascriptサブウィンドウを開く例

1330 ワード

<input type=「button」name=「view Course」value=「参照」onclick=「openSubWindow('link)」/>

var SUBWINDOW_WIDTH = "800px";
var SUBWINDOW_HEIGHT = "600px";
var SUBWINDOW_CENTER = "Yes";
var SUBWINDOW_HELP = "No";
var SUBWINDOW_RESIZABLE = "No";
var SUBWINDOW_STATUS = "No";

function openSubWindow(){
	var dialogUrl;
    var dialogType;
    var parentItems;
    var queryString;
    var width = SUBWINDOW_WIDTH;
    var height = SUBWINDOW_HEIGHT;
     var returnValue = null;
     if( 2 <= arguments.length && arguments.length <= 5){
     	dialogUrl = openSubWindow.arguments[0];
        dialogType = openSubWindow.arguments[1];
        queryString = dialogUrl;
     }
     futures = "dialogWidth="+width+"; dialogHeight="+height+"; center="+SUBWINDOW_CENTER+"; help="+SUBWINDOW_HELP+"; resizable="+SUBWINDOW_RESIZABLE+"; status="+SUBWINDOW_STATUS;
     if(dialogType==1){
        window.showModalDialog(queryString, window, futures);
     }else if(dialogType==2){ 
        subWinOj = window.showModelessDialog(queryString,window,futures);
     }
}