InputBox






<!DOCTYPE html>
<html>
<body>

<p>Click the button to demonstrate the prompt box.</p>

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

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

<script>
function myFunction() {
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! How are you today?";
}
}
</script>

</body>
</html>


************************************************************************************

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display a dialog box which will ask for your favorite drink.</p>

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

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

<script>
function myFunction() {
var text;
var favDrink = prompt("What's your favorite cocktail drink?", "Daiquiri");
switch(favDrink) {
case "Martini":
text = "Excellent choice. Martini is good for your soul.";
break;
case "Daiquiri":
text = "Daiquiri is my favorite too!";
break;
case "Cosmopolitan":
text = "Really? Are you sure the Cosmopolitan is your favorite?";
break;
default:
text = "I have never heard of that one..";
}
document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>










( inputbox.html )- by Paolo Puglisi - Modifica del 17/12/2023