<!DOCTYPE html>
 2 <html>
 3   <head>
 4     <meta charset="UTF-8">
 5     <title>验证用户输入的密码</title>
 6     <script>
 7       var password = prompt(‘请输入密码:‘);
 8       if (password == ‘123456‘) {
 9         alert(‘密码输入正确!‘);
10       } else {
11         alert(‘密码输入错误!‘);
12       }
13     </script>
14   </head>
15   <body></body>
16 </html>
原文:https://www.cnblogs.com/huaobin/p/14162613.html