function limitText(objTextBox, maxCharacters)
{
if(objTextBox.innerText.length >= maxCharacters)
{
if((event.keyCode >= 32 && event.keyCode <=126) || (event.keyCode >= 128 && event.keyCode <= 254))
{
event.returnValue = false;
}
}
}
<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="6" Columns="80" OnKeyDown="javascript:limitText(this,1024)" ></asp:TextBox>
{
if(objTextBox.innerText.length >= maxCharacters)
{
if((event.keyCode >= 32 && event.keyCode <=126) || (event.keyCode >= 128 && event.keyCode <= 254))
{
event.returnValue = false;
}
}
}
<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Rows="6" Columns="80" OnKeyDown="javascript:limitText(this,1024)" ></asp:TextBox>
No comments:
Post a Comment