EDITABLE CODE:
LiveDemo: JavaScript Form Validation : Checking for Empty Fields
Note: The form will not be submitted until a text is supplied in the form filed.