function checkDouble(evt, strValue) {
    var iKeyCode = (evt.which) ? evt.which : event.keyCode;

    //if( iKeyCode <= 46 || iKeyCode > 58 || iKeyCode==47)
    if (iKeyCode <= 46 || iKeyCode > 57 || iKeyCode == 47) {

        // handle "." case
        if (iKeyCode == 46) {

            var is_dot = strValue.indexOf('.');
            if (is_dot == -1) {
                return true;
            }
            else {

                iKeyCode = 0;
                return false;
            }
        }
        else if (iKeyCode != 8 && iKeyCode != 13 && iKeyCode != 9) {
            //alert(iKeyCode);
            //iKeyCode= 0;

            //alert("Please enter Numeric or Decimal value");
            return false;
        }
        else if (iKeyCode == 8 || iKeyCode == 9) {
            return true;
        }
        else {
            iKeyCode = 0;
            return false;
        }
    }
    return true;
}

function checkInteger(evt, strValue) {
    var iKeyCode = (evt.which) ? evt.which : event.keyCode;

    //if( iKeyCode <= 46 || iKeyCode > 58 || iKeyCode==47)
    if (iKeyCode <= 47 || iKeyCode > 57 || iKeyCode == 47) {

        if (iKeyCode != 8 && iKeyCode != 13 && iKeyCode != 9) {
            //alert("Please enter Numeric or Decimal value");
            return false;
        }
        else if (iKeyCode == 8 || iKeyCode == 9) {
            return true;
        }
        else {
            iKeyCode = 0;
            return false;
        }
    }
    return true;
}

Comments (0)