How to use Window Object Confirm in JavaScript

In this article I am going to explain about window object Confirm() Method.
  • 1459

JavaScript Window object Confirm() Method

JavaScript confirm() Method use for display confirmation window for user confirmation before any action. Confirmation dialog box return true or false at the behave of user.


confirm(Your message)




    <script type="text/javascript">

        function myfun() {

            var a;

            var b = confirm("press button");

            if (r == true) {

                x = "Action has been done";


            else {

                x = "Action has not been done";


            document.getElementById("txt").innerHTML = x;





    <button onclick="myfun()">

        click me</button>

    <p id="txt">








You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2018 DotNetHeaven. All rights reserved.