<script language="JavaScript"> <!--function validate(testform){//// Create a basic array containing the numbers that we can use to check if a field contains anything but numbers//var digits="0123456789"var temp//// Check if the Name field is empty - that is, its value is null//if (document.testform.Name.value=="") {//// If field string is null, display a (very bad!!) message, and return false (stop the script and exit here)//alert("No Name !")return false}//// Name field is okay, so check if the age field is too short, displaying// appropriate messages; again, return false if it is//if (document.testform.age.value.length < 1) {alert("You have not told us your age!")return false}if (document.testform.age.value.length <2 ) {alert("Nobody under ten can complete this form!")return false}//// Okay, age field is the correct length (2), so check if it contains anything but the characters in the variable digits//for (var i=0;i<document.testform.age.value.length;i++){temp=document.testform.age.value.substring(i,i+1)if (digits.indexOf(temp)==-1){//// If we find anything but 0-9, display another (bad) message and return false//alert("Invalid Age !")return false } }//// We made it to here - so the form must have passed all the validation tests// To make sure it is sent, we must now return true//return true}// --></script>