如何在iframe中发送表单?

Yun*_*zel 4 html javascript forms iframe post

我想发一个form到里面iframe.我怎样才能做到这一点?

sgo*_*les 9

targetform标签的属性指定了打开操作URL的位置.

你可以这样做:

<iframe name="myframe" id="frame1" src="mydetail.asp"></iframe>
<form action="../mydetail.asp" method="post" target="myframe">
<input type="submit" name="DoIt" value="DoIt">
</form>    
Run Code Online (Sandbox Code Playgroud)

target属性与框架一起使用,以指定应在其中呈现表单响应的框架.如果不存在具有此类名称的帧,则响应将在新窗口中呈现,除非用户覆盖.


Pek*_*ica 5

使用target属性。

<iframe name="my_iframe" src="..."></iframe>

<form action="...." target="my_iframe">
Run Code Online (Sandbox Code Playgroud)