最新发布 使用post打开新窗口跳转新页面

发布时间: 2022-12-30,浏览量:374
function Post(URL, PARAMTERS) {
        //创建form表单
        let temp_form = document.createElement("form");
        temp_form.action = URL;
        //如需打开新窗口,form的target属性要设置为'_blank'
        temp_form.target = "_self";
        temp_form.method = "post";
        temp_form.style.display = "none";
        //添加参数
        for (let item in PARAMTERS) {
            let opt = document.createElement("textarea");
            opt.name = PARAMTERS[item].name;
            opt.value = PARAMTERS[item].value;
            temp_form.appendChild(opt);
        }
        document.body.appendChild(temp_form);
        //提交数据
        temp_form.submit();
    }

热门文章 经典语录

热门文章 热门文章

查看更多