有什么办法可以按顺序一一获取id值,并且组成一个数组吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

 <head>

  <title> new document </title>

  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

  <meta name="author" content="" /

 </head>

 <body onkeydown="keyLogin();">

  <input type="text" class="pass"  value="" />

  <div id="enter" class="login"  onclick="enter_login();"> 登录</div>


  <script type="text/javascript">

      function enter_login(){

        var pwd = $(".pass").val();

            if(pwd==""){

                alert(1);

            }else{

                alert(2);

            }

    }

      function keyLogin(){  

                if (event.keyCode==13){

                    document.getElementById("enter").click(); 

                }                                

            }  

  </script>

 </body>

</html>


aluckdog
浏览 591回答 2
2回答

梦里花落0921

我能执行啊,jquery引用到了吗,按下F12看看console有没有报错

繁星点点滴滴

打断点了没
打开App,查看更多内容
随时随地看视频慕课网APP