Presentation Aspects

Browser-side control

JavaScript

JavaScript

JavaScript Example


function validate(obj) {
   value = obj.value;
   for (n = 0; n < value.length; n++)
      if ( ! isDigit(value.charAt(n))) {
         alert("Field must be numeric");
         return;
      }
   confirm("Field is valid");
}

function isDigit(ch) {
   if (ch >= '0' && ch <= '9')
      return true;
   return false;
}
And can be called by

<form>

Enter number:
<input type="text" onChange="validate(this)">

</form>
                             

StyleSheets

DOM

JavaScript


Jan Newmarch (http://pandonia.canberra.edu.au)
jan@ise.canberra.edu.au
Last modified: Tue Oct 24 14:52:59 EST 2000
Copyright ©Jan Newmarch