How do I submit an html form inside an iframe with

2019-02-06 00:33发布

问题:

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?

回答1:

Target the form to the iframe:

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

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


回答2:

Try using the target attribute of the form tag. You can specify the frame.