| Author: Geetha 05 Sep 2008 | Member Level: Gold | Rating: Points: 3 |
function ValidateText(txtValue) { var txtVal = txtValue.Value; var len = txtVal.length; var Search =0; for(var i = 0;i<len; i++) { if(txtVal.charAt(i) <'0' || txtVal.charAt(i)>'9') Search = Search + 1; } if(Search == len) { alert("Numbers only Allowed"); } }
Regards, Geetha.
|
| Author: UltimateRengan 05 Sep 2008 | Member Level: Diamond | Rating: Points: 3 |
hi,
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <script type ="text/javascript" > function CheckIsNumeric() { var AsciiCode = event.keyCode; if ((AsciiCode < 48) || (AsciiCode > 57)) { alert('Please enter only numbers.'); event.cancelBubble = true; event.returnValue = false; } } </script>
</head> <body> <form id="form1" runat="server"> <div> <input id="Text1" type="text" onkeypress ="CheckIsNumeric()"/></div> </form> </body> </html>
UltimateRengan nathan.rengan@gmail.com Trichy-Rider Group
|
| Author: puneet malviya 14 Dec 2008 | Member Level: Gold | Rating: Points: 4 |
Hi...... <asp:RegularExpressionValidator ID="Validation" ControlToValidate="txttest" Display="None" ErrorMessage="Please, Enter valid value " runat="server" SetFocusOnError="true" ValidationGroup="test" ValidationExpression="^\d{1,7}$"></asp:RegularExpressionValidator>
OR
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head><body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="RegularExpressionValidator" ControlToValidate="TextBox2" ValidationExpression="[0-9]*"> </asp:RegularExpressionValidator></div> </form> </body></html>
|