<SCRIPT language=Javascript>
function allow_num(num) {
var charCode = (num.which) ? num.which : num.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</SCRIPT>
call this function:
<asp:TextBox ID="txt_num" onkeypress="return
allow_num
(event)" CssClass="txt" runat="server"></asp:TextBox>
<input id="Text1"
onkeypress="return
type="text" />
allow_num
(event)"
No comments:
Post a Comment