确认提交

发布于 2024-10-10 01:26:51 字数 101 浏览 0 评论 0 原文

我有一个将信息提交到数据库的表单。我怎样才能做到这一点,以便当我单击“提交”按钮时,我会收到一条警报,询问我是否真的要提交它,当我单击“是”时,它会继续,如果我单击“否”,它不会提交信息。

I have a form that submits information to a database. How can I make it so that when I click the submit button, I get an alert that asks me if I really want to submit it and when I click "Yes" it continues and if I click "no" it does not submit the information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

您的好友蓝忘机已上羡 2024-10-17 01:26:51

使用 JavaScript confirm() 函数。

<input type="submit" onclick="return confirm('Are you sure?')">

如果用户选择,它将返回true并且按钮的默认操作(提交表单)将照常继续。但如果用户选择,它将返回false并且按钮的默认操作将被阻止。

Use JavaScript confirm() function.

<input type="submit" onclick="return confirm('Are you sure?')">

If the user chooses Yes, it will return true and the button's default action (submitting the form) will continue as usual. But if the user chooses No, it will return false and the button's default action will be blocked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文