Function for Check and limit the number of characters allowed in a Textbox.
CheckLength(txt,5) : It will allow only 5 Characters in text box.
Javascript :
function CheckLength(obj,Length)
{
if (obj.value.length>Length)
{
alert("Exceeding Maximum " + Length +" Characters")
obj.focus()
obj.select()
}
} aspx :
asp:textbox id="TextBox1" onkeyup="CheckLength(this,5)" runat="server" width="238px"
No comments:
Post a Comment