Code
<html >
<body>
<h2>JavaScript Confirm Box</h2>
<button onclick="myFunction()">Try it</button>
< p id="demo"></p>
< script >
function myFunction() {
var txt;
var person = prompt("Please enter your name:", "Falguni Thakor");
if (person == null || person == "") {
txt = "User cancelled the prompt.";
} else {
txt = "Hello " + person + "! How are you today?";
}
document.getElementById("demo").innerHTML = txt;
}
</script >
< /body>
</html >