This JavaScript program demonstrates how to display a command prompt and receive the input.
<!DOCTYPE html> <html> <head> <title>XoaX.net's Javascript</title> <script type="text/javascript" src="DisplayingAPrompt.js"></script> </head> <body onload="Initialize()"> <span id="idValue"></span> </body> </html>
function Initialize() {
let sEntered = window.prompt("Enter your name!");
let qSpan = document.getElementById("idValue");
qSpan.innerHTML = "Your name is " + sEntered;
}© 20072025 XoaX.net LLC. All rights reserved.