js检查密码长度等问题

img

img

每个函数都运行过一次,都显示未被定义,咋回事捏
(凑字数凑字数不到30字不给发)

你的

img


html中的id和js中的id对不上
另外的几个属性也是一样的

html文档是从上到下解析的,你这里应该是dom还未解析完成,js代码已经运行了
建议按照以下文档顺序

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="style.css">
  <title>Document</title>
</head>
<body>
  
  <script src=""></script>
  <script>
    // javascript
  </script>
</body>
</html>

img


你的函数checknum(){}是不是少了个闭合标签 } 呢