<%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <script language="javascript" type="text/javascript"> function checkIt(obj, evt) { evt = (evt) ? evt : window.event var charCode = (evt.which) ? evt.which : evt.keyCode if ((charCode < 45 || charCode > 57) && charCode != 8 && charCode != 37 && charCode != 39) { alert("This field accepts numbers only") return false } var t = (charCode / 1) - 48; var v = obj.value + t; var value = v / 1; if(value > 24){ alert("Number should be less than 24"); return false; } return true } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox runat="server" ID="txtNumber" onKeyPress='javascript:return checkIt(this, event)' /> </div> </form> </body> </html>
Saturday, December 17, 2011
How to validate a number between 0-24 with Java Scripts
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment