在调整大小的新弹出窗口中打开表单

Open form in new popup window that is sized

本文关键字:表单 窗口 新弹出 调整      更新时间:2023-09-26

>我创建了新表单和将一些参数传递到另一个页面的按钮;但我需要"提交"按钮来打开大小符合规格的新弹出窗口。

这就是我通过超链接进行操作的方式;我需要按钮的相同功能

out.println("<a onclick='"window.open(this.href,this.target,'height=500, scrollbars=1, width=950, resizable');return false;'" target='"_blank'"  href='"chart.jsp?room=" + B.getNumber() + "&building=" + B.getBuilding() + "'">view chart</a>");

我能想到的最简单的方法是不使用内联JavaScript:

var form = document.getElementsByTagName('form')[0]; // or any other way to identify the form
form.onsubmit = function(e) {
    var eTarget = e.target;
    window.open(eTarget.action, eTarget.name, 'height=500, scrollbars=1, width=950, resizable');
    return false;
};​

JS小提琴概念证明。