我有一个表单,然后有一个 JS 函数来处理它并执行 3 个操作。这是我的功能:
function submit(){
document.optin.action = "link1.php"
document.optin.target = "_self";
document.optin.submit();
window.open('http://link2.html','','scrollbars=yes,height=600,width=900,resizable=yes');
document.optin.action = "link3.php"
document.optin.target = "_self";
document.optin.submit();
}
第二个和第三个操作有效,但第一个操作无效。操作 1 和 3 在同一窗口中打开,后者覆盖前者。知道我的代码有什么问题吗?请...
最佳答案
第一个不起作用,因为您用第三个覆盖了该操作。
我不知道你想做什么,但你不能提交到应该出现在同一窗口上的两个目标。
如果第一次提交只是为了数据目的,我建议您通过ajax进行提交。这样第三个就不会覆盖该操作。
关于javascript - 使用 JS 无法实现多个表单操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2666764/