Example of JavaScript

Let's take a look at checking form input with JavaScript, Example:

The important pieces:

  1. Reference an external javascript file. The javascript functions in this file can now be used within the page.
  2. 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.
  3. onsubmit attribute of form element. This is an "event attribute".