JS 代码
复制代码代码如下:
Fonction BirthdayOnchange (obj) {
var année = $ ("<% = ddl_year.clientid%>"). valeur;
si (année == "année")
retour;
autre
année = ParseInt (année, 10);
var mois = $ ("<% = ddl_month.clientid%>"). valeur;
si (mois == "mois")
retour;
autre
mois = parseInt (mois, 10);
var day = $ ("<% = ddl_day.clientid%>"). valeur;
var wholeday = Getdays (année, mois);
if (1) {
var options = $ ("<% = ddl_day.clientid%>"). Options;
pour (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 (jour <= wholeday && i == jour) {
Options [i] .selected = true;
}
}
}
}
Fonction Getdays (année, mois) {
var dayarr = nouveau tableau (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (mois == 2) {
if ((année% 4 == 0 && an% 100! = 0) || an% 400 == 0 || année <1900)
retour 29;
autre
retour dayarr [mois - 1];
}
autre {
retour dayarr [mois - 1];
}
}
Fonction ajustementAstro () {
var v_astro = getastro ($ ("<% = ddl_month.clientid%>"). valeur, $ ("<% = ddl_day.clientid%>"). valeur);
$ ("<% = astro.clientid%>"). Options [0] .text = v_astro;
}
fonction 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)) {
retourner "魔羯座";
}
else if ((v_month == 1 && v_day> = 21)
|| (v_month == 2 && v_day <= 19)) {
retourner "水瓶座";
}
else if ((v_month == 2 && v_day> = 20)
|| (v_month == 3 && v_day <= 20)) {
retourner "双鱼座";
}
else if ((v_month == 3 && v_day> = 21)
|| (v_month == 4 && v_day <= 20)) {
retourner "白羊座";
}
else if ((v_month == 4 && v_day> = 21)
|| (v_month == 5 && v_day <= 21)) {
retourner "金牛座";
}
else if ((v_month == 5 && v_day> = 22)
|| (v_month == 6 && v_day <= 21)) {
retourner "双子座";
}
else if ((v_month == 6 && v_day> = 22)
|| (v_month == 7 && v_day <= 22)) {
retourner "巨蟹座";
}
else if ((v_month == 7 && v_day> = 23)
|| (v_month == 8 && v_day <= 23)) {
retourner "狮子座";
}
else if ((v_month == 8 && v_day> = 24)
|| (v_month == 9 && v_day <= 23)) {
retourner "处女座";
}
else if ((v_month == 9 && v_day> = 24)
|| (v_month == 10 && v_day <= 23)) {
retourner "天秤座";
}
else if ((v_month == 10 && v_day> = 24)
|| (v_month == 11 && v_day <= 22)) {
retourner "天蝎座";
}
else if ((v_month == 11 && v_day> = 23)
|| (v_month == 12 && v_day <= 21)) {
retourner "射手座";
}
retour "";
}
html
复制代码代码如下:
<div> 出生日期 : </div>
<div>
<asp: dropdownlist id = "ddl_year" runat = "server" onChange = "anniversityChange (this);"> </ asp: dropdownlist> 年
<asp: dropdownlist id = "ddl_month" runat = "server" onChange = "anniversityOnchange (this); ajusghtastro ();"> </ asp: dropdownlist> 月
<asp: dropdownlist id = "ddl_day" runat = "server" onchange = "ajustement ();"> </ asp: dropdownlist> 日
</div>
<div> 星座 : </div>
<div>
<Select id = astro désactivé nom = astro runat = "server">
<Option sélectionnée> 处女座 </ Option>
</lect>
</div>