Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Tuesday, August 24, 2010

JavaScript for textbox should be numeric

JavaScript for textbox should be numeric

This example show validate a textbox value is numeric.When you enter a non nemeric value
in textbox popup message will display.
<asp:TextBox ID="txtMinExperience" onKeyUp="benumeric();" runat="server" MaxLength="50" TabIndex="4"
Width="50px">0</asp:TextBox>

<script language="javascript" type="text/javascript">
function benumeric()
{
var txtMin=document.getElementById('<%=txtMinExperience.ClientID%>');
if(isNaN(txtMin.value)== true)
{
alert("This Field Should Be Numeric.");
txtMin.focus();
txtMin.value="";
return false;
}
return true;
}
</script>

Thanks & Regards
Santosh

2 comments:

  1. This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete
  2. This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete