JS 以POST方式打開新頁面

      /*
        *功能: JS跳轉(zhuǎn)頁面,并已POST方式提交數(shù)據(jù)
        *參數(shù): URL 跳轉(zhuǎn)地址 PARAMTERS 參數(shù)
        */
        function ShowReport_Click() {

            var parames = new Array();
            parames.push({ name: "param1", value: "param1"});
            parames.push({ name: "param2", value: "param2"});

            Post("SupplierReportPreview.aspx", parames);

            return false;
        }

        /*
        *功能: 模擬form表單的提交
        *參數(shù): URL 跳轉(zhuǎn)地址 PARAMTERS 參數(shù)
        */
        function Post(URL, PARAMTERS) {
            //創(chuàng)建form表單
            var temp_form = document.createElement("form");
            temp_form.action = URL;
            //如需打開新窗口,form的target屬性要設(shè)置為'_blank'
            temp_form.target = "_self";
            temp_form.method = "post";
            temp_form.style.display = "none";
            //添加參數(shù)
            for (var item in PARAMTERS) {
                var opt = document.createElement("textarea");
                opt.name = PARAMTERS[item].name;
                opt.value = PARAMTERS[item].value;
                temp_form.appendChild(opt);
            }
            document.body.appendChild(temp_form);
            //提交數(shù)據(jù)
            temp_form.submit();
        }
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容