<asp:TextBox ID="txtConclusion" MaxLength="200" TextMode="MultiLine" Height="100px" Width="400px" runat="server" /><asp:RegularExpressionValidator ID="txtConclusionValidator1" ControlToValidate="txtConclusion"Text="超过200字" ValidationExpression="^[\s\S]{0,200}$" runat="server" />
<HTML> <HEAD> <title>WebForm6</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script language="javascript"> function isOver(sText,len) { var intlen=sText.value.length; if (intlen>len) { alert("The content length must Less than or Equal "+len); sText.focus(); sText.select(); } } </script> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:TextBox id="txtName" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 104px" runat="server" TextMode="MultiLine" Height="112px" Width="271px"></asp:TextBox> </form> </body> </HTML> Public void Page_Load(object sender, System.EventArgs e) { this.txtName.Attributes.Add("onblur","isOver(this,1000);"); }
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛