• js regx验证==== 正则


    String.prototype.Trim = function(){ return Trim(this);}
    String.prototype.LTrim = function () { return LTrim(this); }
    String.prototype.RTrim = function () { return RTrim(this); }
    function LTrim(str) {
        var i;
        for (i = 0; i < str.length; i++) {
            if (str.charAt(i) != " " && str.charAt(i) != " ") break;
        }
        str = str.substring(i, str.length);
        return str;
    } function RTrim(str) {
        var i;
        for (i = str.length - 1; i >= 0; i--) {
            if (str.charAt(i) != " " && str.charAt(i) != " ") break;
        }
        str = str.substring(0, i + 1);
        return str;
    } function Trim(str) {
        return LTrim(RTrim(str));
        }

    <html>
    <head>
        <title>RegTest</title>
        <script type="text/javascript" language="javascript">
            //这是验证:YYYY-MM-DD格式
            function oneclick() {
                //var reg = /^d{4}/d{1,2}/d{1,2}$/;
                var reg = /^[1-9]d*.d*|[1-9]d*|0.d*[1-9]d*$/;
                if(reg.test(1))
                { alert('日期格式正确!'); }
                else { alert('日期格式不正确!'); }
            }
            //这是验证:DD-MM-YYYY格式
            function dateCheck(str) {
                var re = new RegExp("^([0-9]{1,2})[.-]{1}([0-9]{1,2})[.-]{1}([0-9]{4})$");
                return re.exec(str);
            }
        </script>
        </head>
        <body>
            <center>
                <input type="text" value="" name="va" id="va"/>
                <input type="button" value="ccccc" onclick="oneclick();" />
            </center>
        </body>
    </html>
     $(function () {
                $("#btnUP").click(function () {
                    AjaxSubmit("Ajax/AjaxUpload.aspx", "form1", { fileBox: "<%=ID%>", fileName: "Bg" }, function (data) {
                        parent._call2(data);
                    });
                });
                $("#btnBannerUp").click(function () {
                    AjaxSubmit("Ajax/AjaxUpload.aspx", "form1", { fileBox: "<%=ID%>", fileName: "Banner" }, function (data) {
                        parent._call3(data);
                    });
                });
                $("#btnAddFit").click(function () {
                    var bgColor = $("#bgColor").val();
                    var bgUrl =  $("#bgHideUrl").val();
                    var bannerUrl =  $("#bannerHideUrl").val();
                    $.ajax({
                        url: "Ajax/AjaxUpload.aspx",
                        async: true, cache: false,
                        data: {
                            action: 1,
                            bgUrl: bgUrl,
                            bannerUrl: bannerUrl,
                            bgColor: bgColor,
                            zxId:"",
                            shopId: "<%=shopInfo.ShopID%>"
                        },
                        success: function (data) {
                            alert(data);
                        }
                    });

                });
            });

  • 相关阅读:
    显因子模型简介
    关联规则中最小支持度和最小置信度
    Matlab读取音频数据
    初识禁忌搜索算法
    Word中将图表变为表格
    明尼苏达推荐系统导论(第一课 欢迎来到RS)
    python复杂网络分析库NetworkX
    python使用zlib实现压缩与解压字符串
    PostgreSQL 对字段大小写敏感
    pycharm快捷键及一些常用设置
  • 原文地址:https://www.cnblogs.com/panjiayuan/p/3706861.html
Copyright © 2020-2023  润新知