Home > Web Front-end > JS Tutorial > body text

Introduction to the use of confirm() method in JavaScript

黄舟
Release: 2018-05-30 10:29:47
Original
13448 people have browsed it

I believe many friends will know the meaning of confirm when they see the title. The confirm() method is used to display a dialog box with a specified message and OK and Cancel buttons, but there are still many friends who don’t know, so today we Let me introduce to you the use of confirm() method in JavaScript!

If the user clicks the OK button, confirm() returns true. If the cancel button is clicked, confirm() returns false.

It will block all user input to the browser until the user clicks the OK button or the Cancel button to close the dialog box. When confirm() is called, execution of the JavaScript code is paused and the next statement is not executed until the user responds.

Let’s learn how to use it through these two small examples:

The code is as follows:



confrim 的使用方法


js confirm
Copy after login

Summary :

confirm() is used by us for a better user experience. I believe that friends can further understand the use of confirm() by studying this article. I hope Helpful for your work!

Related recommendations:

JavaScript’s three message boxes alert, confirm, prompt

js-confirm-Confirm cancellation dialog box

js confirm function deletion prompt_PHP tutorial

The above is the detailed content of Introduction to the use of confirm() method in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!