<input type="text" id="inputText_' + p_cid + '_2" maxlength="3" value="50" style="30px;" oninput="onBlur_number_setVale(this)" />
function onBlur_number_setVale(p_obj) { var val = 0; if (p_obj.value == "") { val = 0; } else { if (parseInt(p_obj.value) >= 0) { val = parseInt(p_obj.value); } else { var value = p_obj.value; var valueLength = value.length; for (var i = 0; i < valueLength; i++) { var v = value.substr(0, valueLength - 1 - i); if (parseInt(v) >= 0) { val = v; break; } if (i == valueLength - 1) { val = 0; } } } } p_obj.value = val; }