13_获取用户输入.html 576 B

12345678910111213141516171819
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. // 带有输入框的弹框 通过输入框获取到值是字符型
  11. // 可以通过 输入框中 字符型数字*1 转换成数值型
  12. var a = window.prompt("请输入一个数字");
  13. console.log(a * 1 + 1);
  14. // 带有指令的弹框
  15. // var b = window.confirm("是否继续");
  16. // console.log(b);
  17. </script>
  18. </body>
  19. </html>