JS 代码
复制代码代码如下:
função birthoneonchange (obj) {
var ano = $ ("<%= ddl_year.clientid%>").
if (ano == "ano")
retornar;
outro
ano = parseint (ano, 10);
var mês = $ ("<%= ddl_month.clientid%>").
if (mês == "mês")
retornar;
outro
mês = parseint (mês, 10);
var dia = $ ("<%= ddl_day.clientid%>").
var wholeday = getDays (ano, mês);
if (1) {
var options = $ ("<%= ddl_day.clientid%>"). Opções;
for (var i = 1; i <= wholeday; i ++) {
var j = i.toString ();
j = j.Length == 1? "0" + j: j;
options.Length = i + 1;
opções [i] .Value = j;
opções [i] .text = j;
if (dia <= wholeday && i == dia) {
opções [i] .Selected = true;
}
}
}
}
função getDays (ano, mês) {
var Dayarr = nova matriz (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (mês == 2) {
if ((ano % 4 == 0 && ano 100! = 0) || ano % 400 == 0 || ano <1900)
retornar 29;
outro
retornar Dayarr [mês - 1];
}
outro {
retornar Dayarr [mês - 1];
}
}
função ajustestro () {
var v_astro = getastro ($ ("<%= ddl_month.clientid%>").
$ ("< %= astro.clientId %>"). Opções [0] .text = v_astro;
}
função 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)) {
retornar "魔羯座";
}
caso contrário, if ((v_month == 1 && v_day> = 21)
|| (v_month == 2 && v_day <= 19)) {
retornar "水瓶座";
}
caso contrário, if ((v_month == 2 && v_day> = 20)
|| (v_month == 3 && v_day <= 20)) {
retornar "双鱼座";
}
caso contrário, if ((v_month == 3 && v_day> = 21)
|| (v_month == 4 && v_day <= 20)) {
retornar "白羊座";
}
caso contrário, if ((v_month == 4 && v_day> = 21)
|| (v_month == 5 && v_day <= 21)) {
retornar "金牛座";
}
else if ((v_month == 5 && v_day> = 22)
|| (v_month == 6 && v_day <= 21)) {
retornar "双子座";
}
else if ((v_month == 6 && v_day> = 22)
|| (v_month == 7 && v_day <= 22)) {
retornar "巨蟹座";
}
else if ((v_month == 7 && v_day> = 23)
|| (v_month == 8 && v_day <= 23)) {
retornar "狮子座";
}
else if ((v_month == 8 && v_day> = 24)
|| (v_month == 9 && v_day <= 23)) {
retornar "处女座";
}
caso contrário, if ((v_month == 9 && v_day> = 24)
|| (v_month == 10 && v_day <= 23)) {
retornar "天秤座";
}
caso contrário, if ((v_month == 10 && v_day> = 24)
|| (v_month == 11 && v_day <= 22)) {
retornar "天蝎座";
}
else if ((v_month == 11 && v_day> = 23)
|| (v_month == 12 && v_day <= 21)) {
retornar "射手座";
}
retornar "";
}
html
复制代码代码如下:
<div> 出生日期: </div>
<div>
<ASP: DOURSDOWNLIST ID = "ddl_year" runat = "server" onchange = "birthoneonchange (this);"> </asp: DropDownList> 年
<ASP: DOURSDOWNLIST ID = "DDL_MONTH" RUNAT = "Server" OnChange = "BirthdalOnnchange (this);
<ASP: DOURSDOWNLIST ID = "DDL_DAY" RUNAT = "Server" OnChange = "AjudtsTro ();"> </asp: DropDownList> 日
</div>
<div> 星座: </div>
<div>
<SELECT ID = Astro Disable Nome = Astro Runat = "Server">
<Opção selecionada> 处女座 </pption>
</leclect>
</div>