您的位置:首页 > Web前端 > JavaScript

js 获取星座

2010-06-01 15:16 183 查看
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 "";
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: