验证不合格,阻止表单提交

 <script type="text/javascript">

        function check() {
            var name = document.getElementById("albumName");
            var uName = document.getElementById("userName");
            if (name.innerText == "" || uName.innerText == "") {
                alert("相册名或者用户名不可以为空");
               // document.location = "/SougeSystem/Member/MemberPicCreate";
                return false;
            } else {
                up();
                return true;
            }
        }
    </script>   

   创建相册</h4>
    <%using (Html.BeginForm("MemberPicCreate", "Member", FormMethod.Post, new { onsubmit="return check()"}))
      {%>

 新建相册<%=Html.TextBox("albumName")%>

用户名<%=Html.TextBox("userName")%>
    <input type="submit" value="创建相册" name="action" />

<%}%>

posted @ 2012-08-25 11:20  南潇湘  阅读(248)  评论(0编辑  收藏  举报