zoukankan      html  css  js  c++  java
  • 今日工作心得:一段用于验证的jQuery代码

    得到的细节问题:

    1.$("***").attr("disabled",true)设置这个的时候后边的参数不能带引号;

    2.如果将这一段代码写在body中的话不要加$();表示在文档加载完就执行的函数;

    3.如果字符串是""那么split()之后他的长度是1而不是0。 

       <script type="text/javascript">
            $("#<%=this.txtLR_ColumnDir.ClientID %>").keyup(function() {
                if (this.value != "") {
                    var Dirs = "<%=this.myColumnDirs %>";
                    var DirList = Dirs.split("|");

                    $("#DirFlag").html("<img src='images/g.gif'/> <span style='color:Green'>恭喜,目录可以使用。</span>");
                    $("#<%=this.btnOK.ClientID %>").attr("disabled", false);

                    for (var i = 0; i < DirList.length; i++) {
                        if (this.value == DirList[i]) {
                            $("#DirFlag").html("<img src='images/x.gif'/> 对不起,目录已存在。");
                            $("#<%=this.btnOK.ClientID %>").attr("disabled", true);
                        }
                    }
                }
                else {
                    $("#DirFlag").html("<img src='images/x.gif'/> 对不起,必须填写目录。");
                    $("#<%=this.btnOK.ClientID %>").attr("disabled", true);
                }
            });
        </script>

  • 相关阅读:
    Cocos Creator之生命周期函数
    Cocos Creator之基本概念
    Cocos Creator之菜单栏和工具栏
    Cocos Creator之认识
    lvs nat模式+iptables实现fullnat
    k8s cpu绑定
    arp代理
    确定veth pair在容器和宿主机的对应关系
    k8s 滚动发布
    http长连接
  • 原文地址:https://www.cnblogs.com/yuanyuan/p/1761438.html
Copyright © 2011-2022 走看看