<HTML> <HEAD> <TITLE>Basic Form Validation</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function validate () { if (document.forms.order.CustName.value == "") { alert("Please enter your name.") return; }
if (document.forms.order.CustID.value == "") { alert("Please enter your Customer ID.") return; }
if (document.forms.order.Qty.value <= 0) { alert("Please enter a positive number of gadgets.") return; }
document.forms.order.submit(); alert ("Your order has been submitted"); } // --> </SCRIPT> </HEAD> <BODY> <H1 ALIGN="CENTER">Gadget Order Form</H1> <HR> <FORM NAME="order" METHOD="POST" ACTION="mailto:order@company.com"> <B>Customer Name: </B> <INPUT TYPE="TEXT" NAME="CustName" SIZE="25" MAXLENGTH="35"> <BR><BR>