CommonLayer

function MsgNullFormat(colNameCn) {
    return colNameCn + " !";
}

function MsgNaNFormat(colNameCn) {
    return colNameCn + " !";
}

function MsgNumericFormat(colNameCn) {
    return colNameCn + " !";
}

function IsNumber(value) {
    var reg = /^[\d]*$/;
    return null != value.match(reg);
}

function IsNumeric(value) {
    var reg = /^\d+\.{0,1}\d+$/;
    return null != value.match(reg);
}
function GetTrimVal4Txt(id) { return $.trim($("#"+ id).val());}
/// <reference path="jquery-1.4.1.min.js" />
// 
function IsCheckAll(elementId) {
    if ($("#" + elementId).attr("checked")) {
        $("#" + elementId + " input:checkbox").attr("checked", true);
    }
    else {
        $("#" + parentElementId + " input:checkbox").attr("checked", false);
    }
}
// 
$(document).ready(function (elementId, oddColor, evenColor, hoverClass) {
    $("#" + elementId + " tr:odd").css("background-color", oddColor);
    $("#" + elementId + " tr:even").css("background-color", evenColor);
    $("#" + elementId + " tr").hover(function () {
        $(this).addClass(hoverClass)
    }, function () {
        $(this).removeClass(hoverClass)
    });
});
$(function () {

    if ($(".rpt thead").length > 0) {
        $(".rpt >tbody tr").hover(function () {
            $(this).addClass("hoverclass")
        }, function () {
            $(this).removeClass("hoverclass")
        });
    }
    else {
        $(".rpt tr:gt(0)").hover(function () {
            $(this).addClass("hoverclass")
        }, function () {
            $(this).removeClass("hoverclass")
        });
    }
});
function TxtSettings(id, initValue, focusStyle, blurStyle) {
    $("#" + id).focus(function () {
        $(this).attr("class", focusStyle);
        if ($(this).val() == initValue)
            $(this).val("");
    }).blur(function () {
        var v = $(this).val() == "" ? initValue : $(this).val();
        $(this).val(v);
        $(this).attr("class", $(this).val() == initValue ? blurStyle : focusStyle);
    });
}
function JsonDate(str) {
    if (null != str && str != "" && str != "undefined") {
        var matches = str.match(/([0-9]+)/);
        var d = parseInt(matches[0]);
        var obj = new Date(d);
        var year = obj.getFullYear();
        var month = obj.getMonth() + 1;
        var day = obj.getDate();
        var sec = obj.getSeconds();
        var mytime = year + "-" + p(month) + "-" + p(day) + " " + p(obj.getHours()) + ":" + p(obj.getMinutes()) + ":" + p(sec);
        return mytime;
    }
}
function GetTrimVal4Txt(id) {
    return $.trim($("#" + id).val());
}

function IsNumber(value) {
    var reg = /^[\d]*$/;
    return null != value.match(reg);
}

function IsEmail(value) {
    var reg = /^[a-z\d]+(\.[a-z\d]+)*@([\da-z](-[\da-z])?)+(\.{1,2}[a-z]+)+$/;
    return null != value.match(reg);
}

function Password(value) {
    var reg = /^[a-z0-9A-Z]{6,18}$/;
    return null != value.match(reg);
}

function IsTel(value) {
    var reg = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
    return null != value.match(reg);
}

function IsMobilePhone(value) {
    ///^(13+\d{9})|(159+\d{8})|(158+\d{8})|(153+\d{8})$/
    var reg = /^(1\d{10})$/;
    return null != value.match(reg);
}
        // [   ]
        function ResetNo() {
            var iRowNumber = 1;
            $("#tabList > tbody tr").each(function () {
                $(this).find("td[id='RowNumber']").text(iRowNumber);
                iRowNumber++;
            });
        }

좋은 웹페이지 즐겨찾기