3 回答

TA贡献1797条经验 获得超6个赞
您可以通过表单的重定向做到这一点action到<iframe>。它不需要JavaScript或任何其他类型的脚本。
<iframe width="0" height="0" border="0" name="dummyframe" id="dummyframe"></iframe>
<form action="submitscript.php" target="dummyframe">
<!-- form body here -->
</form>
如果您真的很狡猾,则可以在CSS中修改position=absolute和z-index值,以确保框架不会渲染。如果这很重要,无论如何,使用AJAX可能会更好。

TA贡献1820条经验 获得超3个赞
iFrame在页面底部并target在表单中放置一个隐藏的内容:
<iframe name="hiddenFrame" width="0" height="0" border="0" style="display: none;"></iframe>
<form action="/Car/Edit/17" id="myForm" method="post" name="myForm" target="hiddenFrame"> ... </form>
快捷方便。请记住,尽管该target属性仍得到广泛支持(HTML5中受&支持),但HTML 4.01中已弃用该属性。因此,您确实应该使用Ajax来适应未来的需求。
添加回答
举报