onSubmit event executes JavaScript code when a submit event occurs; that is, when a user submits a form.
The isUpper() function will be called when the user clicks on the submit button in the form.
The following script validates the information in the form and only allows it to be submitted if the requirement (lowercase letters only) is met.
isUpper() returns either true or false.
If it returns true, the form will be submitted; otherwise, the submission will be cancelled.
The notation testform.command.value, a path to find the HTML element, is from DOM (Document Object Model).
|
||||||
|
“Hey, ask me if I’m a dinosaur.” “Are you a dinosaur?” “No.” — Jamie Lee |