按字符数控制:
复制代码代码如下:
<nombre del área de texto="gbContenido"
onkeyup="si(este.valor.longitud>2000) este.valor=este.valor.substr(0,2000)"
onkeydown="si(este.valor.longitud>2000) este.valor=este.valor.substr(0,2000)"
onblur="si(este.valor.longitud>2000) este.valor=este.valor.substr(0,2000)"
onpropertychange= "if(este.valor.longitud>2000) este.valor=este.valor.substr(0,2000)"></textarea>
按字节数控制:
复制代码代码如下:
<textarea cols="50" id="descripción" nombre="userModel.description" filas="5"
onkeydown="key1=this.value;value1 = key1.replace(/[/u4e00-/u9fa5]/g,' ');if(value1.length>500) this.value=this.value.substr(0,500) "
onkeyup="key1=this.value;value1 = key1.replace(/[/u4e00-/u9fa5]/g,' ');if(value1.length>500) this.value=this.value.substr(0,500) "
onblur="key1=this.value;value1 = key1.replace(/[/u4e00-/u9fa5]/g,' ');if(value1.length>500) this.value=this.value.substr(0,500) "
onchange="key1=this.value;value1 = key1.replace(/[/u4e00-/u9fa5]/g,' ');if(value1.length>500) this.value=this.value.substr(0,500) "></textarea>