Form Functions

Form Code: clearUp, submitted, and verify functions and conditional statement (if the fails to enter any field, an alert message "Please complete all fields!" will appear, (or else); it will "call" the submitted function, which creates an alert message "Information submitted." If the user strikes the Clear button, all fields will clear.

<script language="text/javascript" language="JavaScript">
function clearUp() {[0].value=""[1].value=""[2].value=""[3].value=""[4].value=""[5].value=""
function submitted() {
alert("Information submitted!")
function verify() {
if([0].value=="" ||[1].value=="" ||[2].value=="" ||[3].value=="" ||[4].value=="" ||[5].value=="") {
alert("Please complete all fields!")
else {
submitted ()
  • On the HTML document under your form, create a button that "calls" the clearUp and verify functions
  • <input type="button" value="submitted" onClick="verify()">
  • <input type="button" value=Clear Form" onClick=clearUp();">