function maxlength(obj,length){ if (obj.value.length>length) obj.value=obj.value.substring(0,length) }