如何在单击提交按钮时显示消息框时间接弹出新窗口

How to pop up a new window indirectly when shown a message box when clicking submit button

本文关键字:新窗口 窗口 时间 单击 提交 按钮 消息 显示      更新时间:2023-09-26

我在单击提交按钮时如何弹出新窗口时遇到问题。到目前为止,我有以下代码:

<form action="printstockin.php" name="sumary" method="post"
 onsubmit="return confirm(
       'Are you sure you want to clear this sale? All items will cleared.')" >

此代码显示一个包含"是"和"否"选项的警告框。我希望当我单击"是"时,它应该弹出一个新窗口。我尝试了不同的东西,但无法得到我想要的。

只需放置

target="_blank"

表单标签的属性:

<form action="printstockin.php" name="sumary" method="post" onsubmit="return confirm('Are you sure you want to clear this sale? All items will cleared.')" target="_blank">

onsubmit =" if (confirm('你确定要清除这笔销售吗?所有项目都将清除。window.open(URL,名称,规格,替换)

试试这个

脚本-

function disp_confirm()
{
 var r=confirm("Are you sure you want to clear this sale? All items will cleared.?")
 if (r==true)
 {
   window.open("http://www.google.com")
 }
 else
 {
  return false;
 }
}

.HTML-

<form action="printstockin.php" name="sumary" method="post" onsubmit="disp_confirm()" >