计算是字符长度
<TEXTAREA class=textarea id=text1 style="WIDTH: 220px; HEIGHT: 200px" cols=100 onchange="gbcount(this,document.getElementById('used'));" onkeyup="gbcount(this,document.getElementById('used'));"> </TEXTAREA> 已用字数: <INPUT disabled maxLength=4 name=used size=5 value=0> <script type="text/javascript"> function gbcount(message,used) { var lenE = message.value.length; var lenC = 0; var CJK = message.value.match(/[^\x00-\xff]/g); var enter = message.value.match(/\r\n/g); if (CJK != null) lenC += CJK.length; if (enter != null) lenC -= enter.length; used.value = lenE + lenC; } </SCRIPT>