现在的位置: 首页 > 综合 > 正文

在aspx页面向iframe中post参数

2014年01月10日 ⁄ 综合 ⁄ 共 594字 ⁄ 字号 评论关闭
 

1.在页面放置一个iframe:
<iframe id="result" name="result" frameborder=0 width=850 height=280 marginheight=0 marginwidth=0 noresize scrolling=yes ></iframe>
注意iframe不需要指定src,且一琮要有id 与name,id与name一定要相同。

2.在<form id="form1" runat="server">...</from> 之后增加一个form用post的方式将数据向iframe中提交:
<form id="frmStaple" method="POST" target="result" action="XXX.aspx">
     <input type="hidden" name="xmbh">
</form>
注意form的target要与iframe的id、name相同

3.在<form id="form1" runat="server">...</from>中增添加按钮或者其他触发frmStaple的提交事件,从而打开XXX.aspx,如:
<input type="button" value="确定" onClick="javascript:frmStaple.submit();">
如果想一打开页面就打开iframe,可以在其他地方使用frmStaple.submit()

抱歉!评论已关闭.