Window confirm() method

Definition and Usage

confirm() The method displays a dialog box containing a message, an OK button, and a Cancel button.

If the user clicks "OK"confirm() method returns true, otherwise return false.

Description

If you want the user to verify or accept some content, you usually use a confirmation box.

The confirmation box moves the focus away from the current window and forces the user to read the message.

Before the user clicks the OK button or Cancel button to close the dialog box, it will prevent the user from entering any input to the browser. In calling confirm() At that time, JavaScript code execution will be paused, and the next statement will not be executed until the user responds.

অন্যান্য দেখুন:

alert() method

prompt() method

প্রতিমান

উদাহরণ 1

Display a confirmation box:

confirm("Press a button!");

স্বয়ংক্রিয়ভাবে প্রয়োগ করুন

উদাহরণ 2

Confirmation box with a newline character:

confirm("Press a button!\nEither OK or Cancel.");

স্বয়ংক্রিয়ভাবে প্রয়োগ করুন

উদাহরণ 3

Display a confirmation box and output the content clicked by the user:

let text;
if (confirm("Press a button!") == true) {
  text = "You pressed OK!";
} else {
  text = "You canceled!";
}

স্বয়ংক্রিয়ভাবে প্রয়োগ করুন

গ্রামার

confirm(message)

প্যারামিটার

প্যারামিটার বর্ণনা
message সুযোগসূত্র।যা নিশ্চিতকরণ বাক্সে দেখানো হবে টেক্সট。

ফলাফল

ধরন বর্ণনা
বুল মান যদি ব্যবহারকারী নিশ্চিত করে ক্লিক করেন, তবে true, না তবে false

ব্রাউজার সমর্থন

সমস্ত ব্রাউজারগুলি সমর্থন করে confirm()

চ্রোম আইই এজ ফায়ারফক্স স্যাফারি ওপেরা
চ্রোম আইই এজ ফায়ারফক্স স্যাফারি ওপেরা
সমর্থন সমর্থন সমর্থন সমর্থন সমর্থন সমর্থন