Program To Make the button to demonstrate the prompt box Using JavaScript in HTML
Program To Make the button to demonstrate the prompt box Using JavaScript in HTML This program will show a button in your browser window and when you click on that button, then a prompt box will popup-ed. In that, you will write your name in text box, then click ok and your message or name display in your browser page. <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 x; var person=prompt("Please enter your name","Harry Potter"); if (person!=null) { x="Hello " + person + "! How are you today?"; document.getElementById("demo").innerHTML=x; } } </script> </body> </html> Thank you for visiting :D :D