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:
<scriptlanguage="javascript"type="text/javascript"> /* Visit http://www.yaldex.com/
for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin function
checkFields(){ name=document.submitform.name.value; email =document.submitform.email.value;
if((name=="")&&(email
=="")){ alert("Please
enter your name or your email address."); returnfalse;
} elsereturntrue;
} // End --> </script> <formaction="http://www.your-web-site-address-here.com/script.cgi"name=submitformonSubmit="return
checkFields()">
Please enter your name or your email
address.<br><br> <tableborder=0>
<tr>
<td
align=center>Name</td>
<td>
</td>
<td
align=center>Email</td>
</tr>
<tr>
<td
align=center><inputtype=textname=namevalue=""onFocus="document.submitform.email.value='';"size=10></td>
<td
align=center>Or...</td>
<td
align=center><inputtype=textname=emailvalue=""onFocus="document.submitform.name.value='';"size=10></td>
</tr>
<tr>
<td
colspan=3align=center><inputtype=submitvalue="Submit!"></td>
</tr>
</table> </form>