<HTML>
<HEAD>
<TITLE>Forms Array Example</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function verifyZip(length){
var zipEntry = document.forms[0].zip.value;
var zipNum = parseInt(zipEntry, 10);
if (document.forms[0].zip.value.length == length){
if(zipNum != 0 && isNaN(zipNum) == false){
alert(zipEntry + " is a valid zip code");
} else {
alert("Invalid Zip Code Entered.");
}
} else {
alert("Invalid Zip Code Entered.");
}
}
function myName(){
var name = document.form2.name.value;
alert("You Entered: " + name);
}
-->
</SCRIPT>
</HEAD>
<BODY>
<P>
<CENTER><B>Forms Example</B></CENTER>
<BR><BR><BR>
<TABLE>
<FORM NAME="form1" METHOD=POST>
<TR>
<TD ALIGN="right">Enter a 5 Digit Zip Code:</TD>
<TD ALIGN="left">
<INPUT TYPE= "TEXT" NAME="zip" SIZE="15">
<INPUT TYPE="BUTTON" NAME="button1" VALUE="Verify" onClick="verifyZip(5)">
</TD>
</TR>
</FORM>
<FORM NAME="form2" ACTION="" METHOD="post">
<TR>
<TD ALIGN="right">Enter Your Name:</TD>
<TD ALIGN="left">
<INPUT TYPE="TEXT" NAME="name" SIZE="15">
<INPUT TYPE="BUTTON" NAME="button2" VALUE="Show Name" onClick="myName(this.form)">
</TD>
</TR>
</FORM>
</TABLE>
</BODY>
</HTML>
|