Example of JavaScript
Let's take a look at checking form input with JavaScript, Example:
The important pieces:
- Reference an external javascript file. The javascript functions in this file can now be used within the page.
- The "example7.js" contains a function ValidateForm. The ValidateForm function checks to see if the email input box is not empty and if the string matches the format of an email address.
-
onsubmit attribute of form element. This is an "event attribute".