POPUP Message Program Using Event

<!DOCTYPE html>

<html>

<body>

<h2>JavaScript Confirm Box</h2>

<button onclick="myFunction()">Please Try it</button>

<p id="Test Confirm Box"></p>

<script>

function myFunction() {

  var txt;

  if (confirm("Please Press a button!")) {

    txt = "You pressed Button!";

  } else {

    txt = "You pressed Cancel Button!";

  }

  document.getElementById("Test Confirm Box").innerHTML = txt;

}

</script>

</body>

</html>


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *