This article describes the method of JS implementing a pop-up input box in a web page. Share it for your reference. The specific analysis is as follows:
Friends who are used to using early settings to set passwords for computer folders must still remember the effect of popping up an input box and then asking you to enter the password to log in and view it. This JS code is to realize that an input box pops up in the current page. Of course, you can enter anything
<html><head><title>js input dialog</title></head><body><script language="javascript"><!--age = prompt("Please enter your age:","20"); if (age != null){alert("You are this year" + age +"year-old!");}else{alert("You pressed the [Cancel] button");}//--></script></body></html>I hope this article will be helpful to everyone's JavaScript programming.