↑
Forms >>>
The visitor must fill in either one of two fields, their name or email address. If they click in either box the other box's value is erased. Ensures that when the form is submitted only one field contains a value. Also contains validation that makes sure both fields are not empty.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
checkFields()
{
name
=
document.submitform.name.value;
email
=
document.submitform.email.value;
if
((name
==
"")
&&
(email
==
"")
)
{
alert("Please
enter your name or your email address.");
return
false;
}
else
return
true;
}
</script>
<form
action="http://www.your-web-site-address-here.com/script.cgi"
name=submitform
onSubmit="return
checkFields()">
Please enter your name or your email
address.<br><br>
<table
border=0>
<tr>
<td
align=center>Name</td>
<td>
</td>
<td
align=center>Email</td>
</tr>
<tr>
<td
align=center><input
type=text
name=name
value=""
onFocus="document.submitform.email.value='';"
size=10></td>
<td
align=center>Or...</td>
<td
align=center><input
type=text
name=email
value=""
onFocus="document.submitform.name.value='';"
size=10></td>
</tr>
<tr>
<td
colspan=3
align=center><input
type=submit
value="Submit!"></td>
</tr>
</table>
</form>
|
→ xmas funds loans
|