将 iframe 表单提交到新窗口


Submit iframed form to a new window

我的表单在 iframe 中,但我希望提交的表单在新窗口中打开。如何做到这一点?

在表单标签中,您只需设置"目标"属性,如下所示:

<form target="some_target">

此属性有 5 个不同的值。

_blank :这会将表单发布到一个全新的窗口。

_self :这是默认选项。它发布到与当前窗体相同的窗口或框架。

_parent :这会发布到当前 iframe 的父级。

_top :这会发布到当前 iframe 的最顶层父级。

框架名称 :您也可以自己命名目标窗口。命名目标将打开一个新窗口,并允许您多次发布到同一窗口。

希望对您有所帮助!

使用:

<form action="form_action.php" target="_parent">

form的默认target属性是_self,这意味着"提交到action页面并在我的框架中显示结果"。如果表单位于 iFrame 中,则结果将显示在 iFrame 中。

为了在父帧中显示结果,请将target="_parent"添加到form打开标记中。

在 iframe 中将其设为表单:

<form target="_parent" action="blubb.php">
    <input type="text" name="var1" />
    <input type="submit" value="Send" />
</form>