<html>
<head>
<SCRIPT LANGUAGE="javascript">
// Checks each field sent as an argument to see if it is blank.
// Every odd-numbered argument accepted to checkforblanks() is a field
to be checked if it
// is blank.
// Every even-numbered argument is what the field specified in the preceding
argument
// is called.
// If any field is blank, returns false after alerting the message:
// "Please enter THISFIELD." where THISFIELD is the argument
that accompanies the correponding
// field.
// Copywright 2000, Ben Packer
function checkforblanks()
{
for (var i = 0; i < arguments.length; i += 2)
{
if (!arguments[i])
{alert("Please enter " + arguments[i+1] + ".");return
false;}
}
return true;
}
function validate()
{
// Make sure none of the required fields are empty
var isFull = checkforblanks(document.myForm.name.value, "your name",
document.myForm.state.value, "your state",
document.myForm.country.value, "your country",
document.myForm.miscfield.value, "miscellaneous field");
if (!isFull)
{return false;}
}
</SCRIPT>
</head>
<body >
<table width="80%" border="1" cellspacing="2"
cellpadding="2" align="center" bgcolor="#ece8cf"
bordercolor="#666666" class="bord2">
<tr>
<td align="center"> <font size="3"><b>םיטרפה
לכ יולימל ספוט קדוב </b></font></td>
<tr>
<td align="left"> .וליעפהל ידכ 'דכו ןשקאה תדוקפ תא סינכהל
ךרוצ שי .חלשי אל
הז ספוטש בל ומיש <br>
.ספוטה תקידבל טפירקסה תמגוד קר יהוז <BR>
<TABLE border="0">
<FORM NAME="myForm" onsubmit="return validate()">
<TR>
<TD>Name:</TD><TD><INPUT TYPE="text" NAME="name"
SIZE="40"></TD>
</TR>
<TR><TD>State:</td><td><INPUT TYPE="text"
NAME="state" SIZE="40"></td>
</tr>
<tr><td>Country:</td><td><INPUT TYPE="text"
NAME="country" SIZE="40"></td>
</tr>
<tr><td>
Misc Field:</td><td><INPUT TYPE="text" NAME="miscfield"
SIZE="40"></td>
</tr><BR>
<tr><td> </td><td><INPUT TYPE="submit"
VALUE="Submit">
<INPUT TYPE="reset"></td></tr>
</TABLE>
</FORM>
</td>
<tr>
<td align="left"> </td>
</table>
</body>
</html>
|