Now tweet, that text box can only input 200 words as if, then more will be automatically deleted, or prompt word limit, with JS can realize this function. Today brought this JS limit form text box text number of examples, I believe there is a good reference to this aspect. For ease of use, the code is split into HTML form sections and JavaScript code sections:
HTML Form section, the code is as follows:
<formname=myformAction=""><textareaname= "message"Wrap= "Physical"cols= "+"rows= "4"OnKeyDown= "Textcounter (this.form.message,this.form.remlen,125);"onKeyUp= "Textcounter (this.form.message,this.form.remlen,125);"></textarea><BR>You can also enter<inputreadonly Type= "text"name= "Remlen"size= "4"maxlength= "3"value= " the">of characters</Div></form>
JavaScript code section:
<script language= "JavaScript" >function textcounter (field, Countfield, maxlimit) {// define functions, pass in 3 parameters, respectively, form name, form field element name, character limit if (Field.value.length > maxlimit)// if the number of elements in the element area is greater than the maximum number of characters, field.value = field.value.substring (0, Maxlimit) is truncated by maximum character number; Else // displays the number of remaining characters that can be entered within the form page text box countfield.value = maxlimit- field.value.length;} </SCRIPT>
Note: Two pieces of code can be copied to the same page.
JS limit the number of text boxes textarea