Q:

asp textbox javascript validator

there are many post about how to prevent an ASP textbox to accept only numbers, but could somebody give me a JS example, how to check if the entered value is between 0-100?
My validator fires each time key is entered and checks if it is a number or not, but do not know how to extend it to check the final value against 0-100 range.
function onlyDotsAndNumbers(event) {
    var charCode = (event.which) ? event.which : event.keyCode
    if (charCode == 46) {
        return true;
    }
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

    return true;
}

Cheers
A

A:

You need to check out the whole value of the text box.
function onlyDotsAndNumbers(event) {
    var charCode = (event.which) ? event.which : event.keyCode
    if (charCode == 46) {
        return true;
    }
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    var boxValue = $(event.target).val();
    if (boxValue > 100 || boxValue < 0)
        return false;

    return true;
}

