在我的
代码中,我可以显示一个窗口或另一个窗口,但不能同时启动两个窗口。如果选中两个复选标记,它将默认为仅第一个。如果第二个只是检查,它将转到第二个if/popup url位置。如何启动两个具有 2 个不同 url 的弹出窗口?
<form action="" method="POST" target="popup">
Send a message : <input type="text" name="twitmessage"><br>
<input type="checkbox" name="twitter" value="My Posting Text">Would you like to send to Twitter?<br>
<input type="checkbox" name="facebook" value="Stuff to Post to facebook">Would you like to post to Facebook?<br>
<input type="submit" name="submit_cycle" value="Submit">
</form>
<?php
session_start();
// store session data
$_SESSION['twitmessage'] = $_POST['twitmessage'];
if(isset($_POST['submit_cycle'])) {
if($_POST['twitter']){
echo "<script type='"text/javascript'"> window.open('../index.php?p=members','popup','width=700,height=400,left=200,top=200,scrollbars=1') ;</script>";
//header("location: ../index.php?p=members");
}
if($_POST['facebook']){
echo "<script type='"text/javascript'"> window.open('../index.php?p=paybill','popup','width=700,height=400,left=200,top=200,scrollbars=1') ;</script>";
//header("location: ../index.php?p=paybill");
}else{
echo "Something bad happened";
}
}
?>
如果您为窗口指定相同的名称(在本例中为"弹出窗口"):
window.open(url1, 'popup', options);
window.open(url2, 'popup', options);
浏览器将在第二个弹出窗口中重复使用第一个窗口。
为您的窗口指定不同的名称,例如"popup1"和"popup2":
window.open(url1, 'popup1', options);
window.open(url2, 'popup2', options);
这将导致打开 2 个不同的弹出窗口。