下面应该使用你的示例代码,认为你正在寻找target =“_ blank”,而不是_self,因为_self是同一个窗口,并且具有相同的没有目标值的效果。另外,不要以为目标=“_ blank”这些天受到鼓励,再加上带有标签的浏览器,它只会在新标签页中打开,而不会被重新调整大小。
希望下面的帮助基于试图居中弹出
<form target="popup" action="google.com" onsubmit="window.open('', this.target, 'width=300,height=300,resizable,scrollbars=yes'); return true;">
<input type="submit" value="click here"/>
</form>
新的示例代码。
我认为quesiton令人困惑,因为它不清楚弹出窗口是否访问服务器端的东西,如果它需要访问表单内容。针对这个问题提供的其他答案也可以根据您的情况适合您。下面是我修改后的代码,希望这会有帮助,但不会100%确定,因为上下文有点令人困惑
<script>
function openWindow(h, w, url) {
leftOffset = (screen.width/2) - w/2;
topOffset = (screen.height/2) - h/2;
window.open(url, this.target, 'left=' + leftOffset + ',top=' + topOffset + ',width=' + w + ',height=' + h + ',resizable,scrollbars=yes');
}
</script>
<form name="form2" id="form2" method="post" action="google.com" onsubmit="openWindow(300, 300, 'google.com');">
<input type="submit" value="click here"/>
</form>
“新页面(窗口)”是否意味着模态窗口? – 2012-02-29 11:56:53
亚模态窗口会好的 – Tom 2012-02-29 12:00:56