如何在iframe中提交html表单而不更改外页? [英] How do I submit an html form inside an iframe without changing the outer page?

查看:92
本文介绍了如何在iframe中提交html表单而不更改外页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编辑一些现有的html,其中javascript在iframe中加载另一个页面。在页面中是一个HTML表单。当我点击提交时,我希望外页保持不变并将iframe更改为结果页面。但是,现在整个页面都会更改为表单的结果页面。我猜有一种方法可以解决这个问题。有什么建议吗?

I'm editing some existing html where the javascript loads a another page inside an iframe. In the page is an html form. When I hit submit, I'd like for the outer page to stay and the iframe to change to the results page. However, right now the whole page changes to the results page for the form. I'm guessing there's a way to solve this javascript. Any suggestions?

推荐答案

将表格定位到iframe:

Target the form to the iframe:

<iframe name="foo"></iframe>

<form target="foo"></form>

这篇关于如何在iframe中提交html表单而不更改外页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆