JS 代码
复制代码代码如下:
function birthriendEnchange (obj) {
var año = $ ("<%= ddl_year.clientid%>"). valor;
if (año == "año")
devolver;
demás
año = parseint (año, 10);
var mes = $ ("<%= ddl_month.clientid%>"). valor;
if (mes == "mes")
devolver;
demás
mes = parseint (mes, 10);
var day = $ ("<%= ddl_day.clientid%>"). valor;
var wholeday = getdays (año, mes);
if (1) {
VAR OPTIONS = $ ("<%= ddl_day.clientid%>"). Opciones;
para (var i = 1; i <= wholeday; i ++) {
var j = I.ToString ();
J = J.Length == 1? "0" + J: J;
opciones.length = i + 1;
opciones [i] .value = j;
opciones [i] .Text = j;
if (day <= wholeday && i == día) {
opciones [i] .selected = true;
}
}
}
}
función getdays (año, mes) {
var dayarr = nueva matriz (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (mes == 2) {
if ((año % 4 == 0 && año % 100! = 0) || año % 400 == 0 || año <1900)
regresar 29;
demás
regreso dayarr [mes - 1];
}
demás {
regreso dayarr [mes - 1];
}
}
función ajustastro () {
var v_astro = getastro ($ ("<%= ddl_month.clientid%>"). valor, $ ("<%= ddl_day.clientid%>"). valor);
$ ("< %= Astro.clientid %>"). Opciones [0] .Text = v_astro;
}
función 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)) {
regresar "魔羯座";
}
else if ((v_month == 1 && v_day> = 21)
|| (v_month == 2 && v_day <= 19)) {
regresar "水瓶座";
}
else if ((v_month == 2 && v_day> = 20)
|| (v_month == 3 && v_day <= 20)) {
regresar "双鱼座";
}
else if ((v_month == 3 && v_day> = 21)
|| (v_month == 4 && v_day <= 20)) {
regresar "白羊座";
}
else if ((v_month == 4 && v_day> = 21)
|| (v_month == 5 && v_day <= 21)) {
regresar "金牛座";
}
else if ((v_month == 5 && v_day> = 22)
|| (v_month == 6 && v_day <= 21)) {
regresar "双子座";
}
else if ((v_month == 6 && v_day> = 22)
|| (v_month == 7 && v_day <= 22)) {
regresar "巨蟹座";
}
else if ((v_month == 7 && v_day> = 23)
|| (v_month == 8 && v_day <= 23)) {
regresar "狮子座";
}
else if ((v_month == 8 && v_day> = 24)
|| (v_month == 9 && v_day <= 23)) {
regresar "处女座";
}
else if ((v_month == 9 && v_day> = 24)
|| (v_month == 10 && v_day <= 23)) {
regresar "天秤座";
}
else if ((v_month == 10 && v_day> = 24)
|| (v_month == 11 && v_day <= 22)) {
regresar "天蝎座";
}
else if ((v_month == 11 && v_day> = 23)
|| (v_month == 12 && v_day <= 21)) {
regresar "射手座";
}
devolver "";
}
html
复制代码代码如下:
<Div> 出生日期 : </div>
<div>
<ASP: DropDownList id = "DDL_YEAR" Runat = "Server" OnChange = "CUMPLEAMBILDS (this);"> </Asp: DropDownList> 年
<ASP: DropDownList id = "DDL_MONTH" Runat = "Server" OnChange = "BirthidessEnchange (this); Attetastro ();"> </Asp: DropDownList> 月
<ASP: DropDownList id = "DDL_Day" runat = "Server" onChange = "AttleSastro ();"> </Asp: DropDownList> 日
</div>
<Div> 星座 : </div>
<div>
<Seleccione ID = Astro Discabled Name = Astro Runat = "Server">
<Opción seleccionada> 处女座 </opción>
</Select>
</div>