JavaScript Example

This example validates a TextField as containing numeric characters only

<script>
function validate(obj) {
   value = obj.value;
   for (n = 0; n < value.length; n++)
      if ( ! isDigit(value.charAt(n))) {
         alert("Field must be numeric");
         return;
      }
}
</script>
<input type="text" onChange="validate(this)">

javascript.html


Slide 24 ©Copyright 1997 Jan Newmarch