麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > JavaScript > 正文

js日期、星座的級聯顯示代碼

2019-11-20 21:12:57
字體:
來源:轉載
供稿:網友

js 代碼

復制代碼 代碼如下:

    function birthdayOnchange(obj) {
        var year = $("<%= DDL_Year.ClientID%>").value;

        if (year == "year")
            return;
        else
            year = parseInt(year, 10);


        var month = $("<%=DDL_Month.ClientID%>").value;
        if (month == "month")
            return;
        else
            month = parseInt(month, 10);

        var day = $("<%=DDL_Day.ClientID%>").value;
        var wholeday = getDays(year, month);

        if (1) {
            var options = $("<%=DDL_Day.ClientID%>").options;
            for (var i = 1; i <= wholeday; i++) {
                var j = i.toString();
                j = j.length == 1 ? "0" + j : j;
                options.length = i + 1;
                options[i].value = j;
                options[i].text = j;
                if (day <= wholeday && i == day) {
                    options[i].selected = true;
                }
            }
        }
    }

 function getDays(year, month) {
        var dayarr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

        if (month == 2) {
            if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0 || year < 1900)
                return 29;
            else
                return dayarr[month - 1];
        }
        else {
            return dayarr[month - 1];
        }
    }

    function adjustAstro() {
        var v_astro = getAstro($("<%=DDL_Month.ClientID%>").value, $("<%=DDL_Day.ClientID%>").value);
        $("<%=astro.ClientID %>").options[0].text = v_astro;
    }

    function getAstro(v_month, v_day) {
        v_month = parseInt(v_month, 10)
        v_day = parseInt(v_day, 10);

        if ((v_month == 12 && v_day >= 22)
  || (v_month == 1 && v_day <= 20)) {
            return "魔羯座";
        }
        else if ((v_month == 1 && v_day >= 21)
  || (v_month == 2 && v_day <= 19)) {
            return "水瓶座";
        }
        else if ((v_month == 2 && v_day >= 20)
  || (v_month == 3 && v_day <= 20)) {
            return "雙魚座";
        }
        else if ((v_month == 3 && v_day >= 21)
  || (v_month == 4 && v_day <= 20)) {
            return "白羊座";
        }
        else if ((v_month == 4 && v_day >= 21)
  || (v_month == 5 && v_day <= 21)) {
            return "金牛座";
        }
        else if ((v_month == 5 && v_day >= 22)
  || (v_month == 6 && v_day <= 21)) {
            return "雙子座";
        }
        else if ((v_month == 6 && v_day >= 22)
  || (v_month == 7 && v_day <= 22)) {
            return "巨蟹座";
        }
        else if ((v_month == 7 && v_day >= 23)
  || (v_month == 8 && v_day <= 23)) {
            return "獅子座";
        }
        else if ((v_month == 8 && v_day >= 24)
  || (v_month == 9 && v_day <= 23)) {
            return "處女座";
        }
        else if ((v_month == 9 && v_day >= 24)
  || (v_month == 10 && v_day <= 23)) {
            return "天秤座";
        }
        else if ((v_month == 10 && v_day >= 24)
  || (v_month == 11 && v_day <= 22)) {
            return "天蝎座";
        }
        else if ((v_month == 11 && v_day >= 23)
  || (v_month == 12 && v_day <= 21)) {
            return "射手座";
        }
        return "";
    }


html
復制代碼 代碼如下:

                <DIV>出生日期:</DIV>
                <DIV>
                    <asp:DropDownList ID="DDL_Year" runat="server"  onchange="birthdayOnchange(this);"></asp:DropDownList> 年
                    <asp:DropDownList ID="DDL_Month" runat="server"  onchange="birthdayOnchange(this);adjustAstro();"></asp:DropDownList> 月
                    <asp:DropDownList ID="DDL_Day" runat="server" onchange="adjustAstro();"></asp:DropDownList> 日
                </DIV>

                <DIV>星座:</DIV>
                <DIV>
                    <SELECT id=astro disabled name=astro runat="server">
                        <OPTION selected>處女座</OPTION>
                    </SELECT>
                </DIV>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久久免费看毛片 | 美国av免费看 | 91精品国产综合久久婷婷香 | 日本大片在线播放 | 亚洲人成在线播放网站 | 青热久思思 | 国产精品亚洲激情 | 特色一级黄色片 | 97人操 | 欧美精品一区二区三区在线播放 | 国产91丝袜在线熟 | 主播粉嫩国产在线精品 | 中国黄色一级生活片 | 久久久新 | av电影网在线观看 | 日韩大片在线永久观看视频网站免费 | 一区二区三区欧美精品 | 久久亚洲国产午夜精品理论片 | 国产精品观看在线亚洲人成网 | 日本精品久久久一区二区三区 | 羞羞网站在线观看入口免费 | av色哟哟 | 一级爱片 | a黄毛片| 黄网站在线免费看 | 国产精品久久久久久久娇妻 | 黄视频网站免费观看 | 精品亚洲夜色av98在线观看 | 精品久久久久久久 | 日本在线一区二区 | 日本黄色免费播放 | 羞羞的视频在线免费观看 | 欧美综合在线观看视频 | 色97在线| 亚洲激情91 | 国产91小视频在线观看 | 国产亚洲综合一区二区 | 成人在线视频在线观看 | 在线观看国产一区二区三区 | 黑人一区二区三区四区五区 | 国产呦在线观看视频 |