javascript string validation

mmriceiu
01:30:11
Hi all, I have a question about form validation related. The form can take only numeric value. If someone press a key which is nonnumeric, (string, _,-,@ etc ) an alert box prompted.
mmriceiu
05-03-2012
Hi, I have tried to solve your problem. The code is bellow. I think it will work.

<script type="text/javascript">
function check(){
var mmr = document.getElementById("mmr").value;
//alert(mmr);
if(isNaN(mmr)){
alert('sarfwsetf');
}
}
</script>
<input id="mmr" type="text" name="fds" onkeyup="check()" />
Please Login to post your reply or start a new topic