Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
只是想知道是否可以使用onSubmit="window.open('url')",但不是打开一个新选项卡,而是将其加载到当前页面上。谢谢你。
onSubmit="window.open('url')"
您可以使用目标_self在同一窗口中打开页面。您将从false活动中返回以防止表格发布:
_self
false
onsubmit="window.open('url','_self');return false;"
对于这种情况,你可以试试这个: onSubmit="window.location.href='url';return false;"
onSubmit="window.location.href='url';return false;"
最好避免内联 JavaScript,并尝试将 JavaScript 与 html 分开。