【问题标题】:How to submit a form to a page such that this new page opens in a new window (rather than a new tab)? [duplicate]如何将表单提交到页面,以便此新页面在新窗口(而不是新选项卡)中打开? [复制]
【发布时间】:2017-05-10 18:30:02
【问题描述】:

这是this question of mine 的后续问题。

我需要在单击按钮时打开一个新窗口,并将数据传递到新页面。

一种方法是有一个构成hidden字段的表单(包含我要传递到新页面的数据)并在按钮的点击监听器中使用JS提交这个表单。

到目前为止,这似乎很顺利。我将为<form>action 属性分配一个我想在单击按钮时打开的页面的URL 值。然后我会在按钮的点击监听中通过JS提交这个表单。

挑战/问题-我在问-我如何在新窗口中打开新页面(将在表单提交时打开的页面)?

【问题讨论】:

  • target="_blank"

标签: javascript php html forms


【解决方案1】:

试试这个:

<form action="#otherpage" method="post" target="_blank">

    <-- form fields here -->

</form>

【讨论】:

    猜你喜欢
    • 2015-03-10
    • 2012-11-27
    • 2014-05-24
    • 1970-01-01
    • 2011-06-25
    • 2014-09-20
    • 2015-07-26
    • 2011-04-09
    • 2011-09-11
    相关资源
    最近更新 更多