不能验证表单?
<form id="liuyan" name="liuyan" method="post" onsubmit ="return check();" action="liuyan.asp?action=add" ><table width="760" height="450" border="0" align="center" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC" class="css">
<tr>
<td height="82" colspan="2" bgcolor="#FFFFFF"><table height="50" cellpadding="0" cellspacing="0">
<tr>
<td width="445" height="20"><strong> 发 送 留 言</strong> </td>
</tr>
<tr>
<td>填写下列表单,直接发送留言给企业。 </td>
</tr>
</table></td>
</tr>
<tr>
<td width="176" height="51" bgcolor="#FFFFFF"><div align="right"><strong><span class="STYLE1">*</span> 姓名:</strong></div></td>
<td width="577" bgcolor="#FFFFFF">
<div align="center">
<label>
<div align="left">
<input name="Lname" type="text" id="Lname" size="30" />
<strong>性别: </strong>
<input name="sex" type="radio" value="1" checked="checked" />
男
<input type="radio" name="sex" value="0" />
女</div>
</label>
</div> </td>
</tr>
<tr>
<td height="39" bgcolor="#FFFFFF"><div align="right"><strong><span class="STYLE1">* </span>联系电话:</strong></div></td>
<td bgcolor="#FFFFFF"><label>
<input name="tel" type="text" id="tel" size="30" />
请输入您的固定电话,有分机请填写分机</label></td>
</tr>
<tr>
<td height="38" bgcolor="#FFFFFF"><div align="right"><strong>手机:</strong></div></td>
<td bgcolor="#FFFFFF"><label>
<input name="phone" type="text" id="phone" size="30" />
建议填写,以便企业能及时联系到您。</label></td>
</tr>
<tr>
<td height="33" bgcolor="#FFFFFF"><div align="right"><strong><span class="STYLE1">* </span>电子邮件:</strong></div></td>
<td bgcolor="#FFFFFF"><label>
<input name="email" type="text" id="email" size="30" />
请填写您的常用电子邮箱,这也是企业联系您的首选方式 </label></td>
</tr>
<tr>
<td height="59" bgcolor="#FFFFFF"><div align="right"><strong>联系地址:</strong></div></td>
<td bgcolor="#FFFFFF"><label>
<input name="address" type="text" id="address" size="50" />
<br />
请准确填写您的详细地址,方便企业寄送产品资料给您!</label></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="right"><strong><span class="STYLE1">*</span> 留言内容:</strong></div></td>
<td bgcolor="#FFFFFF"><label>
<textarea name="nr" cols="60" rows="6" id="nr"></textarea>
</label></td>
</tr>
<tr>
<td height="22" bgcolor="#FFFFFF"><div align="right"><strong><span class="STYLE1">* </span>验证码:</strong></div></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td height="33" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"><label>
<input name="Submit" type="submit" value="留 言" />
</label></td>
</tr>
</table>
</form>
<script language="javascript">
function check()
{
if (checkspace(document.liuyan.Lname.value)
document.Lliuyan.name.value.length < 2){
document.Lliuyan.name.focus();
alert("名字长度不能小于2,请重新输入!");
return false;
}
}
function checkspace(checkstr) {
var str='';
for (i=0;i<checkstr.length; i++){
str=str+'';
}
return (str==checkstr);
}
//-->
</script>