zoukankan      html  css  js  c++  java
  • JS验证控件合法性方法代码

    <script type="text/javascript">
    // 验证合法性
    function validate(name,zname,length)
    {
        var str=eval("document.all['" + name + "'].value;");
        var strlength = parseInt(length);
        if(str == "")
        {
             Alert("输入的"+zname+"信息内容不能为空!",'','','提示',function gotomethod()
                                                              {
                                                                eval("document.all['"+name+"'].focus();")
                                                              },''); 
            return false;
        }
        if(str.length>strlength)
        {
             Alert("输入的"+zname+"信息长度不能大于"+strlength+"!",'','','提示',function gotomethod()
                                                                      {
                                                                        eval("document.all['"+name+"'].focus();")
                                                                      },''); 
            return false;
        }
        return true;
    }
    </script>
  • 相关阅读:
    PHP返回XML与JSON数据
    Canvas学习-1
    PHP与cURL
    PHP调用SOAP Webservice
    Ubuntu查找文件是否安装
    API Centeric Web Application论文
    Git学习2
    An invalid character [32] was present in the Cookie value
    关于eclipse项目的x号报错的一些问题
    关于eclipse的项目前有感叹号和errors exist in required project相关问题
  • 原文地址:https://www.cnblogs.com/wangpei/p/2468293.html
Copyright © 2011-2022 走看看