1<! DOCTYPE html>234<meta charset= "Utf-8" >5<title> website Home </title>6<style>7 . aa{8width:80%;9 height:300px;Ten Resize:none; One padding:10px; A } -</style> - the<body> - -<textarea class= "AA" id= "BB" autofocus></textarea> -<span id= "MSG" ></span> +</body> - +<script> A function$ (ID) { at returndocument.getElementById (ID); - } -String.prototype.trim =function (){ - return This. replace (/^\s+|\s+$/g, "); - } - vara=$ (' BB ')); inA.onkeyup =function (){ - if( This. value.length>50){ to$ (' msg '). innerhtml= ' input up to 50 characters '; + This. value= This. Value.trim ();//clear the end of the space - This. value= This. VALUE.SUBSTR (0,50);//50 characters are intercepted to allow input the}Else{ *$ (' msg '). Innerhtml= ' You have entered ' + This. value.length+ ' Words '; $ }Panax Notoginseng } -</script>
Control the number of message text and display the number of inputs