2012-08-09 49 views
-1

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

+0

在javascript或php中尝试'window.location'你可以使用'header'或'redirect' – 2012-08-09 13:32:41

+1

尝试'form'标签中的'target'属性 - 'target =“_ parent”' – Matt 2012-08-09 13:36:13

回答

6

在表单标签,你只需要设置“目标”属性,就像:

<form target="some_target"> 

有5个不同的值这个属性。

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

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

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

_top:该信息发布到当前iframe的最顶层父节点。

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

希望有帮助!

+0

thx你救了我的一天:) – 2012-08-10 08:24:41

3

使用:“提交给action页面,并显示在我的帧的结果”

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

thx you save my一天:) – 2012-08-10 10:20:39

1

默认target属性的form_self这意味着,如果表单位于iFrame内,则结果将显示在iFrame中。

为了在父框架中显示结果,请将target="_parent"添加到form开放标签。

+0

thx你救了我的一天:) – 2012-08-10 08:32:44

1

设为您的iframe内部形状:

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

thx你救了我的一天:) – 2012-08-10 08:25:20