一般在textarea的属性中加入下面事件即可: onpropertychange='if(this.value.length>=50){this.value=this.value.substring(0,49)