我用如下代码验证用户名是否为空,可是不知道那错了,就是不起做用,用户名为空照样也能提交过去!请问怎样解决
<head>
<script language="javascript">
function checkForm(){
if(document.frmRegister.tname.value==""){
alert('用户名不能为空');
<%response.write "123"%>
return false;
}
}
</script>
</head>
<body>
<div style="position: absolute; width: 301px; height: 346px; z-index: 1; left: 411px; top: 125px" id="layer1">
<form name="form1" method=get action=zc.asp onsubmit="return checkForm();">
<table border="1" width="303" id="table1" height="395">
<tr>
<td width="56" align="center"><font size="2">用户名</font></td>
<td width="151" colspan="2"><input type="text" name="tname" size="20" id="tname"></td>
<td width="74"> </td>
</tr>
<tr>
<td width="56"> </td>
<td width="40"><input type="submit" value="提交" name="submit"></td>
<td width="105"><input type="reset" value="重置" name="submit1"></td>
<td width="74"> </td>
</tr>
</table>
</form>
</div>
</body>