Home Top Ad

Responsive Ads Here

Write a program to Prompt Dilog Box using html JavaScript

Share:

 <html>

<body>


<h2>JavaScript Prompt</h2>


<button onclick="myFunction()">Click Me</button>


<p id="demo"></p>


<script>

function myFunction() {

  let text;

  let person = prompt("Please enter your name:", "Savera");

  if (person == null || person == "") {

    text = "User cancelled the prompt.";

  } else {

    text = "Hello " + person + "! How are you today?";

  }

  document.getElementById("demo").innerHTML = text;

}

</script>


</body>

</html>


Post a Comment

No comments

Welcome to saveracom.blogspot.com

Data Science using Spreadsheet Software Assignment 3

Printing Workbooks select the cells you want to print and then set that area as the print area   Steps to set a print area: Select the cells...