剛才在做一個功能,在頁面A上面點(diǎn)擊某個按鈕,彈出模態(tài)窗口(window.showModalDialog),頁面為B。在頁面B上有一個按鈕,需要在當(dāng)前的模態(tài)窗口中加載頁面C,但是經(jīng)過測試發(fā)現(xiàn)在頁面B上適用window.href="C.html"或者window.navigate("C.html")都會打開新的IE窗口。只好想一個變通的辦法,當(dāng)頁面B的按鈕點(diǎn)擊之后,設(shè)置window.returnValue="GOTO_C",就是設(shè)置一個特殊的返回值,來標(biāo)識要轉(zhuǎn)向頁面C。頁面B的按鈕點(diǎn)擊代碼如下:
function gotoNextStep() {
window.returnValue = "GOTO_NEXT_STEP";
window.close();
}
頁面A的代碼就要判斷B返回的值是什么,然后決定如何對應(yīng)動作。
function popupB() {
var retVal = window.showModalDialog("B.htm", "",
"dialogHeight:286px; dialogWidth:408px; center:yes; resizable:yes");
if (retVal == "GOTO_C") {
window.showModalDialog("C.htm", "",
"dialogHeight:286px; dialogWidth:408px; center:yes; resizable:yes");
}
return true;
}
邏輯上有點(diǎn)怪異,但是現(xiàn)在能夠想到的就是這個變通方法了。
測試環(huán)境:Windows XP SP2, IE 6.0
posted on 2008-05-09 10:44
YODA 閱讀(1037)
評論(1) 編輯 收藏