asp:textbox only allow seven or ten characters using javascript

Posted by Kannan1986 under ASP.NET on 6/3/2010 | Views : 3296 | Status : [Member] | Replies : 1
Hi all

asp:textbox only allow seven or ten characters using javascript




Responses

Posted by: Susantaown on: 6/3/2010 [Member] Starter

Up
0
Down
Hi use this Java script
-------------------------------------

<script type="text/javascript">
function Count()
{
var count=document.getElementById("TextBox1").value.length;
if((parseInt(count)==7)||(parseInt(count)==10))
{
return true;
}
alert("Please Enter 7 or 10 char");
return false;
}
</script>

<asp:TextBox ID="TextBox1" onblur="return Count()" runat="server"></asp:TextBox>

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response