ポップアップ ウィンドウは、ユーザーがドキュメント ページを別のウィンドウで開くことができるようにするために使用されます。ユーザーが次のドキュメント ページを開こうとすると、前のドキュメント ページのウィンドウをすべて閉じる必要があります。
基本的に、複数のポップアップ ウィンドウを閉じたいと思います。開いたポップアップ ウィンドウの参照を保存するために、ポップアップ ウィンドウの参照を含む配列を変数に保存し、その変数の値を隠しフィールドに保存しました。
popup = window.open('', '', sOptions);
が返され[object]
、これ[object]
を取得すると、オブジェクトがこのプロパティまたはメソッドをサポートしていないというエラーが生成されます。
asp/vb.net を使用して開発した Web アプリケーションで、次の JavaScript を使用しています。
var popupWin = new Array();
function OnPopupClick(url,title,name) {
var popup = null;
var sOptions;
sOptions = 'status=yes,menubar=no,scrollbars=yes,resizable=yes,toolbar=no,titlebar=yes,location=0,directories=0';
sOptions = sOptions + ',width=' + (screen.availWidth - screen.availWidth / 2).toString();
sOptions = sOptions + ',height=' + (screen.availHeight - 50).toString();
sOptions = sOptions + ',screenX=0,screenY=0'
sOptions = sOptions + ',left=' + ((screen.availWidth / 2) - 10).toString();
sOptions = sOptions + ',top=0';
html = '<html><head><title>'+ title + '</title></head><body style="margin: 0px 0; text-align:center; "><IMG src="' + url + '" BORDER=0 NAME=image height="' + (screen.availHeight - 50).toString() +'" width="' + ((screen.availWidth - screen.availWidth / 2)-20).toString() +'" onload="window.resizeTo((document.image.width-(document.image.width-(screen.availWidth - screen.availWidth / 2)))+10,((document.image.height*1.3)-(screen.availHeight - 50))+((screen.availHeight - 50)*3)";></body></html>';
popup = window.open('', '', sOptions);
popup.document.open();
popup.document.write(html);
popup.document.focus();
popup.document.close();
if(document.getElementById('<%= hidTitle.ClientID %>').value!=name){
ClosePopupWin(document.getElementById('<%= hidWinRef.ClientID %>').value);
}
TrackPopupWinOpen(popup,name);
}
function TrackPopupWinOpen(winName,title) {
popupWin[popupWin.length] = winName;
var index = popupWin.length-1;
var val = popupWin.join();
document.getElementById('<%= hidWinRef.ClientID %>').value=val;
document.getElementById('<%= hidTitle.ClientID %>').value=title;
}
function ClosePopupWin(retVal) {
popupWin[popupWin.length]=retVal.split();
var openCount = popupWin.length;
for (i = 0; i < openCount; i++) {
popupWin[i].close();
}
}
私は何を間違っていますか?
サードパーティのツールを使用できません。ASPで利用可能なコントロールのみを使用できます。