<form id="frm_1" name="frm_1" target="_self" method="GET" action="local_page.php" >
</form>
<form id="tgt_1" name="tgt_1" target="_blank" method="POST" action="http://stackoverflow.com/" >
</form>
<a onclick="test(event, '1'); " href="#" >Click Here</a>
<script>
function test(event, id){
document.getElementById("frm_"+id).submit;
document.getElementById("tgt_"+id).submit;
}
</script>
是否可以打开新选项卡/窗口并更改当前页面?
据我所知,不可能同时提交两份表格。既然您使用的是 PHP,为什么不看看cURL https://www.php.net/manual/en/book.curl.php图书馆?它允许您发送 POST 和 GET 请求并用 PHP 解析结果。
要回答标题中的问题,如果您只想一键打开两个页面,您可以这样做(请原谅内联javascript):
<a
href="http://www.google.com"
target="_blank"
onclick="document.location.href='http://www.yahoo.com'"
>Click here to open Google in a new window and yahoo in this window</a>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)