校园美景图画:Javascript Post on Form Submit open a new window

来源:百度文库 编辑:偶看新闻 时间:2024/05/10 15:32:08
        var productinfo = $("#order").html();                            //为你要传的那段html        var form = document.createElement("form");        form.setAttribute("method", "post");        form.setAttribute("action", "../PrintPage.aspx");        //../PrintPage.aspx为你要传过去的那个页面        form.setAttribute("target", "_blank");        var hiddenField = document.createElement("input");        hiddenField.setAttribute("name", "productInfo");       //productInfo用来在你要传过去的那个页面进行接收的变量        hiddenField.setAttribute("value", productinfo);        form.appendChild(hiddenField);        document.body.appendChild(form);             form.submit();