0

別のjspファイルを呼び出してshowmodalダイアログウィンドウとして開くjspファイルがあります。

file1.jspがfile1.jsを介してfile2.jspを呼び出すとします。

File1.jsp-> File1.js(それぞれのjsファイル)File2.jsp-> File2.js(それぞれのjsファイル)

ここで、File2.jspでoncloseを処理するために、File2.jsに関数を追加しました。

ウィンドウを閉じるを押したが、古いウィンドウを表示するだけでなく、キャンセルとしてオプションを選択した場合。既存のモーダルウィンドウの上にモーダルウィンドウが表示されます。なぜこうなった。明らかな何かが欠けていますか?

予想されること:[閉じる]を選択して[キャンセル]をクリックすると、何も起こりません。

File2.js関数:

function handleOnClose() {

    var resultsDoc = document.frames('searchBuffer').document;

    if (event.clientY < 0) {
        var bool = confirm('Are you sure you want to close the window ?');
        if (!bool) { //Issue occurs here
            window.showModalDialog("File2.jsp", "", "dialogWidth:1000px;dialogHeight:650px");
        }
        else {
            resultsDoc.all('searchResults').innerText = '';

            document.someSearch.submit();
        }
    }

    window.returnValue = 'Discard';

}
4

1 に答える 1

0

変更されたFile2.js関数:

function handleOnClose() {

    var resultsDoc = document.frames('searchBuffer').document;

    if (event.clientY < 0) {
        var bool = confirm('Are you sure you want to close the window ?');
        if (!bool) { //Issue occurs here
            //*******removed the showmodal dialog window call
              window.returnValue = 'Sorry';
        }
        else {
            resultsDoc.all('searchResults').innerText = '';

            document.someSearch.submit();
    window.returnValue = 'Discard';
        }
    }

}

呼び出し元のjs(file1.js)で、戻り値が「Discard」であるかどうかを確認し、そうであればページを更新します。それ以外の場合は、showmodalウィンドウを再度呼び出します。結果はバッファに保存されるので、取得は問題ありません。チャームのように機能します

于 2012-10-08T00:42:26.943 に答える