日期:2014-05-16  浏览次数:20363 次

获取自己属性和星座的js
<html>
<head>
<script language="javaScript">
function f_GetAnimal(ld_year) 
{
    var la_Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
    alert(la_Animals[(ld_year-4)%12]);
}
function f_GetAstro(ld_month,ld_day)
{
    var s="魔羯水瓶双鱼牧羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
    var arr=[20,19,21,21,21,22,23,23,23,23,22,22];
	alert(s.substr(ld_month*2-(ld_day<arr[ld_month-1]?2:0),2));
}
</script>
</head>
<body>
<input type="button" name="" id="" value="获取属性" onclick="javascript:f_GetAnimal(1987)"/>
<input type="button" name="" id="" value="获取星座" onclick="javascript:f_GetAstro(1,27)"/>
</body>
</html>