<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var name = prompt("Please enter your name", "XYZ");
if (name != null) {
alert('Your name is ' + name )
}
}
</script>
</body>
</html>