I have the following code below position in the head and the body of web page. I cannot resolve the error message that appears when I click on the Submit button. I use IE6. Can anyone help me please, I’m a newbie to JavaScript.
Thank you.
Eric
HEAD
<SCRIPT LANGUAGE=”JavaScript”>
<!—
function validinput(FormSignIn)
{
document.write(“This function was executed”);
if ((FormSignIn.txtName.value == “” || FormSignIn.txtName.value == null) || (FormSignIn.txtContact.value == “” || FormSignIn.txtContact.value == null))
{
alert(“Name and Contact No. cannot be empty”);
}
}
//—>
</SCRIPT>
BODY
<form name=”SignIn” method=”POST” action=”BilliardsTourneySignIn.asp”>
<table border=”0″ width=”100%” id=”table8″>
<tr>
<td width=”89″><b><font size=”2″>Name:</font></b></td>
<td width=”158″>
<input type=”text” name=”txtName” size=”25″ style=”font-family: Times New Roman; font-size:
10pt; font-weight: 700″></td>
</tr>
<tr>
<td width=”89″><b><font size=”2″>Contact No.:</font></b></td>
<td width=”158″>
<input type=”text” name=”txtContact” size=”25″ style=”font-family: Times New Roman; font- size: 10pt; font-weight: 700″></td>
</tr>
</table>
<p>
<input type=”submit” value=”Submit” name=”cmdSubmit” onclick=”validinput(this.form)”></p>
</form>
ERROR MESSAGE: ‘txtName.value’ is null or not an object