Asp.net_实时显示文本框字数

来源:岁月联盟 编辑:exp 时间:2012-08-24

[javascript]
<script language="javascript" type="text/javascript"> 
        function countNum() 
        { 
            var count=document.getElementById("txtText").value.length; 
            document.getElementById("lblCount").value=count; 
            } 
    </script> 

<script language="javascript" type="text/javascript">
        function countNum()
        {
            var count=document.getElementById("txtText").value.length;
            document.getElementById("lblCount").value=count;
            }
    </script>[csharp] view plaincopyprint?   <asp:TextBox ID="txtText" name="txtText" runat="server" Columns="80" Rows="8" TextMode="MultiLine" 
       Width="650px" Height="150px" onkeyup="countNum();"></asp:TextBox> 
(已输入<input id="lblCount" type="button" style="border-style: none; background: none;" value="0" />字) 

                    <asp:TextBox ID="txtText" name="txtText" runat="server" Columns="80" Rows="8" TextMode="MultiLine"
                        Width="650px" Height="150px" onkeyup="countNum();"></asp:TextBox>
                 (已输入<input id="lblCount" type="button" style="border-style: none; background: none;" value="0" />字)