限制TextArea控件的字节数

<html>
<head>
    
<script type="text/javascript">
        
var TextUtil = new Object();
        TextUtil.isNotMax 
= function(oTextArea)
        {
            
return oTextArea.value.length != oTextArea.getAttribute("maxlength");
        }
    
</script>
</head>
<body>
<textarea rows="5" cols="25"  maxlength="20" onkeypress="return TextUtil.isNotMax(this)"></textarea>
</body>
</html>