JS implements the method of popping up an input box in a web page

  • 2020-05-10 17:40:48
  • OfStack

This article illustrates an example of how JS can pop up an input box in a web page. Share with you for your reference. The specific analysis is as follows:

If you're used to password your computer folder in the early days, remember when you had to type in your password and log in, and this JS code is going to pop up an input box on your current page, and you can type 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 this year " + age +" At the age of !");
}else{
alert(" You press the [ cancel ] button ");
}
//-->
</script>
</body>
</html>

I hope this article is helpful for you to design javascript program.


Related articles: