点提交时不是会checkform吗?!
我也已经有了这个函数了呀
可是却不用checkform就可以提交了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script language="JavaScript">
function checkform()
{
if (document.form1.username.value="" || document.form1.username.value.length < 2) {
document.form1.username.focus();
alert("用户名长度不能小于2,请重新输入!");
return false;
}
}
</script>
<BODY>
<form name="form1" method="post" action="UserProc.asp" onsubmit="return checkform(this);">
<label>
<input name="username" type="text" id="username">
</label>
<p>
<label>
<input type="submit" name="Submit" value="提交">
</label>
</p>
</form>
</BODY>
</HTML>
[此贴子已经被作者于2006-3-27 16:02:26编辑过]