onsubmit问题
我要实现的功能是:当textarea中为空时,提示“不能为空”;可是为什么就算在check()函数中没有“return true” 也会提交数据呢?提示窗口就更是看不到了;也就是说根本没有经过check()函数的验证就提交了!~
这是什么原因,望高手指点!~
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改帖</title>
<script language="javascript">
function Check()
{
if(document.fModArt.subject.value=="")
{
alert("主贴的标题不能为空!~");
fModArt.subject.focus();
return false;
}
if(document.fModArt.words.value=="")
{
alert("帖子的内容不能为空!~");
fModArt.words.focus();
return false;
}
return false;
}
</script>
</head>
<link rel="stylesheet" href="../css/style.css" />
<script src="../js/dateTime.js"></script>
<body>
<!--#include file="../conn.asp"-->
<%
contId=request("id")
sql="select * from tb_content where contId="&contId
rs.open sql,conn,1,3
%>
<table width="800" border="0" cellpadding="0" cellspacing="0" align="center">
<!--DWLayoutTable-->
<tr>
<td width="800" height="140" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="140"><!--#include file="top.asp"--></td>
</tr>
</table></td>
</tr>
<tr>
<td height="320" valign="top"><table width="100%" style="border:1px solid #6699FF">
<!--DWLayoutTable-->
<tr>
<td width="800" height="320" align="center" valign="middle">
<form name="fModArt" method="post" action="ArticleModData.asp" onsubmit="return Check();">
<table width="500" height="300" border="1" bordercolordark="#FFFFFF" bordercolorlight="#6699FF" cellpadding="0" cellspacing="0">
<input type="hidden" name="contId" value="<%=contId%>" />
<tr>
<td width="500" height="30" align="center" colspan="2" bgcolor="#6699FF">
<font size="+2">修改帖</font>
</td>
</tr>
<%if rs("UpperId")=0 then%>
<tr>
<td width="150" height="50" align="center">
标题:
</td>
<td width="250" height="50" align="left">
<input type="text" name="subject" size="40" value="<%=rs("subject")%>" />
</td>
</tr>
<%end if%>
<tr>
<td width="150" height="200" align="center">
内容:
</td>
<td width="250" height="200" align="left">
<textarea name="words" cols="40" rows="10"><%=rs("words")%></textarea>
</td>
</tr>
<tr>
<td width="500" height="30" align="center" colspan="2">
<input type="submit" value="修改" />
<input type="reset" value="重置" />
</td>
</tr>
</table>
</form>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="100" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="100"><!--#include file="bottom.asp"--></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>