NET 彈出頁面窗口選擇返回值

字號:


    在網(wǎng)頁中 點(diǎn)擊一個(gè)按鈕 彈出一個(gè)頁面窗口,選擇彈出頁面窗口的值,關(guān)閉窗口,界面得到值
    在對話框要顯示的頁面中<head></head>標(biāo)簽內(nèi)加入“ <base target="_self" /> ”。
    處理回發(fā)彈出新頁面的問題
    主要功能描述:
    在網(wǎng)頁中 點(diǎn)擊一個(gè)按鈕 彈出一個(gè)頁面窗口,選擇彈出頁面窗口的值,關(guān)閉窗口,界面得到值
    代碼如下:
    //對B界面選擇值處理
    <input type="button" id="btnClose" value="確認(rèn)并關(guān)閉窗口" onclick="closeWin()" />
    function closeWin() {
    //把B界面的值傳到A界面去
    window.returnValue = totalCount;
    window.close();
    }
    //A界面需要選擇值
    function showUnitDialog2(id) {
    var rdm = Math.random();
    //打開B界面
    var result = window.showModalDialog("GoodsStocketacke.aspx?id=" + id + "&t=" + rdm, "盤點(diǎn)明細(xì)", "dialogWidth=800px;dialogHeight=500px;center=1");
    //接受B界面的值
    if (result) {
    $("#txtRealCount").val(result);
    $("#txtRealCount").attr("readonly", "true");
    $("#tbUnit tr:eq(1) td:eq(3)").html(result);
    initButton();
    }
    }