Text Field Number Validation Java Script

by Francis 2012-11-27 17:46:52

Text Field Number Validation
In text field allowed to enter only numbers not for alphabets and symbols etc...


JS Syntax
string.replace(/[^\d\.]/g, '');



<html>
<head>
<script type="text/javascript">

function checnum(as)
{
var a = as.value;
as.value = a.replace(/[^\d\.]/g, '');
}
</script>
</head>
<body>
Number : <input type=text onkeyup=checnum(this)>
</body>
</html>

1040
like
0
dislike
0
mail
flag

You must LOGIN to add comments