var input = document.getElementById("test");
var check = function () {
var val = +this.value;
if (typeof val === "number" && val < 0) {
this.value = 0;
}
if (typeof val === "number" && val > 60) {
this.value = 60;
}
if (isNaN(val)) {
this.value = "";
}
};
input.addEventListener("keyup", check, false);