第一步以下是核心代码在页面引用或进行封装都可 <script language=javascript type=text/javascript> function textLimitCheck(thisArea maxLength SpanId) { if (thisAreavaluelength > maxLength) { thisAreavalue = thisAreavaluesubstring( maxLength) thisAreafocus() } /*回写span的值当前填写文字*/ var varss=(剩余字数+(maxLengththisAreavaluelength)+); documentgetElementById(SpanId)innerHTML =varss; } </script> 第二步文本框应用此函数 <asp:TextBox ID=txtOwner_Name runat=server Width=px MaxLength= onkeyup=textLimitCheck(thisspOwner_Name) BackColor=Info></asp:TextBox> <span id=spOwner_Name ><em>(字以内)</em></span> |