• 判断文本框的取值


     1 <!DOCTYPE html>
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     5     <title></title>
     6     <script src="jq/jquery-3.0.0.min.js"></script>
     7 </head>
     8 <body>
     9     <input type="text" value="" id="a1" />
    10     <input type="text" value="" id="a2" />
    11     <input type="text" value="" id="a3" />
    12     <input type="text" value="" id="a4" />
    13     <input type="button" value="确定" id="a5" />
    14     <script>
    15         $(document).ready(function () {
    16             $("input[type='button']").click(function () {
    17                 //alert("为空")
    18                 //数组
    19                 var num = $("input[type='text']");
    20                 var aaa = "";
    21                 for (var i = 0; i < num.length; i++) {
    22                     if (num.eq(i).val() == "") {
    23                         aaa += "第" + i + "个文本框为空";
    24                         //a+=b   相当于   a = a+b
    25                     }
    26                 }
    27                 alert(aaa);
    28             });
    29         });
    30     </script>
    31 </body>
    32 </html>
  • 相关阅读:
    java——ArrayList中remove()方法疑问总结
    java——ArrayList中contains()方法中的疑问
    C语言中signed和unsigned理解
    IO流——常用IO流详解
    Lost's revenge
    Searching the String
    DNA repair
    Ring
    Wireless Password
    Censored!
  • 原文地址:https://www.cnblogs.com/1412660554a/p/5917742.html
Copyright © 2020-2023  润新知