zoukankan      html  css  js  c++  java
  • ASP_Login

    ===第一种===================================================================================================
    <script type="text/javascript">
        function validateLogin()
        {
            if (document.getElementById("<%= TextBoxLoginName.ClientID %>").value == "") {
                alert("名称不能为空");
                return false;
            }
            if (document.getElementById("<%=TextBoxLoginPassword.ClientID %>").value == "") {
                alert("密码不能为空");
                return false;
            }
        }
        function CancelLogin()
        {
            document.getElementById("<%=TextBoxLoginName.ClientID %>").value = "";
            document.getElementById("<%=TextBoxLoginPassword.ClientID %>").value = "";
        }
    </script>
    <fieldset>
    <legend style="text-align:center" >登陆CMS后台管理</legend>
       <form id="form1" runat="server" action="/User/Login">   //提交服务器  //2
       管理员:<asp:TextBox ID="TextBoxLoginName" runat="server" ></asp:TextBox>
       <br />
       密&nbsp; 码 :<asp:TextBox ID="TextBoxLoginPassword" runat="server"></asp:TextBox>
       <br />
       <br />
       <asp:Button ID="ButtonOK" runat="server" Text="登陆" OnClientClick="return validateLogin()"/>   //登陆时验证非空 //1
       <span style="margin-left:30px;"></span>
       <asp:Button ID="ButtonConcel" runat="server" Text="取消" OnClientClick="CancelLogin()"/>        //清空   //1
      </form>
    </fieldset>
    ********************
    功能:登陆功能正常
    弊端:点击“取消_清空"按钮后,可以清空,但是也提交服务器,加重负担
    =============================================================================================================
    ===第二种====================================================================================================
    <fieldset>
    <legend style="text-align:center" >登陆CMS后台管理</legend>
       <form id="form1" runat="server"> 
       管理员:<asp:TextBox ID="TextBoxLoginName" runat="server" ></asp:TextBox>
       <br />
       密&nbsp; 码 :<asp:TextBox ID="TextBoxLoginPassword" runat="server"></asp:TextBox>
       <br />
       <br />
       <asp:Button ID="ButtonOK" runat="server" Text="登陆" PostBackUrl="/User/Login"/>  //提交服务器
       <span style="margin-left:30px;"></span>
       <asp:Button ID="ButtonConcel" runat="server" Text="取消"/> 
      </form>
    </fieldset>
    ********************
    功能:登陆功能正常
    弊端:“登陆"按钮,本人不会加验证,应为OnClientClick="return validateLogin()"和 PostBackUrl="/User/Login"不共存
    只能在后台加验证(服务端向客户端注册脚本块)
    ================================================================================================================
  • 相关阅读:
    android开发中如何开启用户安装的应用程序?
    丑数查找算法
    session.save_path目录大量session临时文件带来的服务器效率问题
    MOSS点滴(1):如何开发和部署feature
    如何将Excel中两个单元格或两列中的数据合并
    如何在 MOSS 2007 启用 Session
    MOSS LIST的一些属性说明
    国外广播电台
    Excel 导出 按钮
    在文档库或 Windows SharePoint Services SharePoint Portal Server 中创建一个新的文件夹或新文档时,您会收到一个"指定的文件或文件夹名太长"错误消息
  • 原文地址:https://www.cnblogs.com/blogLYF/p/5654005.html
Copyright © 2011-2022 走看看