| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1008 人关注过本帖
标题:onsubmit问题
只看楼主 加入收藏
peswe
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2006-11-22
收藏
 问题点数:0 回复次数:1 
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>
搜索更多相关主题的帖子: onsubmit quot DTD check title 
2008-05-24 12:55
渚薰
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:1132
专家分:0
注 册:2006-8-6
收藏
得分:0 
要return false

个人ajax技术专题站: " target="_blank">http://www. 我不会闲你烦,只会闲你不够烦!
2008-05-26 10:19
快速回复:onsubmit问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039796 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved