zoukankan      html  css  js  c++  java
  • Web端 年月日下拉表 密码判断 按钮判断是否提交

    生日:
    <asp:DropDownList ID="selYear" runat="server"></asp:DropDownList>年
    <asp:DropDownList ID="selMonth" runat="server"></asp:DropDownList>月
    <asp:DropDownList ID="selDay" runat="server"></asp:DropDownList>日

    后台代码

        for (int i = Convert.ToInt32(DateTime.Now.Year); i > 1900; i--)
              {
                  ListItem li = new ListItem();
                  li.Text = i.ToString();
                  li.Value = i.ToString();
                  selYear.Items.Add(li);
              }
              for (int i = 1; i < 13;i++ )
              {
                  ListItem li = new ListItem();
                  li.Text = i.ToString();
                  li.Value = i.ToString();
                  selMonth.Items.Add(li);
              }
              for (int i = 1; i < 32;i++ )
              {
                  ListItem li = new ListItem();
                  li.Text = i.ToString();
                  li.Value = i.ToString();
                  selDay.Items.Add(li);
              }
    View Code

    js代码

      var Year = window.document.getElementById("selYear");
        var Month = window.document.getElementById("selMonth");
        var Day = window.document.getElementById("selDay");
        Year.onchange = function () {
            
            dropchang();
        }
        Month.onchange = function () {
            
            dropchang();
        }
        function dropchang()
        {
            if (Month.value == "4" || Month.value == "6" || Month.value == "9" || Month.value == "11")
            { days(30); }
            else if (Month.value == "2")
            {
                if ((Year.value % 4 == 0 && Year.value % 100 != 0) || Year % 400 == 0)
                { days(29); }
                else
                { days(28);}
            }
        }
    
        function days( count )
        {
            Day.options.length = 0;
            for(var i=1;i<=count;i++)
            {
                Day.value.length=0;
                var op=document.createElement("option");
                op.value=i;
                op.innerHTML=i;
                Day.appendChild(op);
            }
        }
    View Code

    密码判断

    密码:
    <asp:TextBox ID="TextBox2" TextMode="Password" runat="server"></asp:TextBox><br />
    确认密码:
    <asp:TextBox ID="TextBox3" TextMode="Password" runat="server"></asp:TextBox>
    <asp:Label ID="Label2" runat="server" Text=""></asp:Label>

    js代码

     // 判断密码是否一致    给按钮用的是否提交
        var ispwd = false;
        var txt2 = document.getElementById("TextBox2");
        var txt3 = document.getElementById("TextBox3");
        var label2 = document.getElementById("Label2");
    
    
        function Pwd (p1,p2)
        {
            if(p1.value==p2.value)
            {
                label2.innerText="正确";
                label2.style.color="green";
                ispwd=true;
            }
            else
            {
                label2.innerText="密码不一致";
                label2.style.color = "red";
               
                ispwd=false;
            }
        }
        txt2.onkeyup = function () { Pwd(txt2, txt3); }
        txt3.onkeyup = function () { Pwd(txt2, txt3); }
    View Code

    按钮提交

     <asp:Button ID="Button1" OnClientClick="return go();" runat="server" Text="Button" />

    js代码    用密码是否一致 和昵称  不能为空  判断是否正确  正确才能提交

    function go()
    {
    return ispwd && nickname;
    }

  • 相关阅读:
    delphi 的插件机制与自动更新
    delphi 的 ORM 框架
    canner CMS 系统 (公司在台湾) https://www.canner.io/
    区块链 ---- 数字货币交易
    BIM平台 http://gzcd.bim001.cn
    TreeGrid 控件集 :delphi 学习群 ---- 166637277 (Delphi学习交流与分享)
    UniGUI 如何进行 UniDBGrid 的单元 Cell 的计算 ?
    国产 WEB UI 框架 (收费)-- Quick UI,Mini UI
    iOS尽量不要在viewWillDisappear:方法中移除通知
    Tips:取消UICollectionView的隐式动画
  • 原文地址:https://www.cnblogs.com/zhangwei99com/p/6890108.html
Copyright © 2011-2022 走看看