function calcuulate(){ var gears = new Array(9); var bestRatios = new Array(10); var currentSpot = 0, tempRatio = 0.123, difference = 0.123,answerString = "", ans2string = ""; var tempThresh = document.getElementById('threshField').value; if(isNaN(tempThresh) || tempThresh < 0){ threshold = 0; document.getElementById('threshField').value = 0; }else{ threshold = tempThresh } for(i =0; i < 11; i++) { bestRatios[i] = 9; } ================== function inc_or_dec(which) { var value = new Number(document.getElementById('threshField').value); if(isNaN(value) || value < 0){ value = 0; }else if(value >= .05 && which == false){ value -= .05; value = Math.round(value*100)/100; }else if(which == true){ value += .05; value = Math.round(value*100)/100; }else{ value = 0 } document.getElementById('threshField').value = value; delete value; } ======================