好日子,我试图让这段代码在新窗口中运行;下面是我的代码:在新的浏览器/窗口上点击提交按钮后打开PHP操作
TEST1.PHP
<html><head>
<script>
function submitForm(action)
{
document.getElementById('1').action = action;
document.getElementById('1').submit();
}
</script>
<title>test</title></head><body><form id="1" name="test-1" action="test3.php" method="post">
<input name="fname"><input name="lname"><br>
<input value="Save" name="save")="" type="submit">
<input value="Nwindow" name="nwindow" onclick="submitForm('test2.php');
window.open='test2.php'" type="submit">
TEST2.PHP
<html><head>
<form id="2" name="test-2" action="test2.php" method="post">
<title>test</title></head><body>
<input name="fname" value="<?php echo $_POST['fname']; ?>">
<input name="lname" value="<?php echo $_POST['lname']; ?>">
<br>
</form>
</body></html>
他们都工作正常,但我想为nwindow按钮执行TEST2.PHP在另一个窗口/浏览器上;我试图打开窗口,但它不工作。
我是新的JavaScript,所以我不知道这可以做到。
任何帮助,非常感谢。
在此先感谢。
这个答案可能会帮你:) http://stackoverflow.com/a/726803/3415760 – BlackStarHH 2014-10-06 09:25:59
您不应该使用数字作为JavaScript的ID。你应该改变你的表格ID为 – cronoklee 2014-10-06 09:32:02
感谢提醒cronoklee – 2014-10-06 09:41:46