js输入年份判断生肖教程

js输入年份判断生肖,js输入年份输出生肖代码教程如下:

1.自定义出生年份

查询生肖:生肖值

js实现代码:


function getpet () {
var toyear = 1997;
var birthyear = document.frm.inyear.value;
var birthpet="Ox"
x = (toyear - birthyear) % 12
if ((x == 1) || (x == -11)) {
birthpet="榧�" }
else {
if (x == 0) {
birthpet="鐗�" }
else {
if ((x == 11) || (x == -1)) {
birthpet="铏�" }
else {
if ((x == 10) || (x == -2)) {
birthpet="鍏�" }
else {
if ((x == 9) || (x == -3)) {
birthpet="榫�" }
else {
if ((x == 8) || (x == -4)) {
birthpet="铔�" }
else {
if ((x == 7) || (x == -5)) {
birthpet="椹�" }
else {
if ((x == 6) || (x == -6)) {
birthpet="缇�" }
else {
if ((x == 5) || (x == -7)) {
birthpet="鐚�" }
else {
if ((x == 4) || (x == -8)) {
birthpet="楦�" }
else {
if ((x == 3) || (x == -9)) {
birthpet="鐙�" }
else {
if ((x == 2) || (x == -10)) {
birthpet="鐚�" }
}
}
}
}
}
}
}
}
}
}
}
document.frm.birth.value = birthpet;
}

显示效果图:http://www.chinawe.net/tools/shengxiao/

 

参考文章:http://tishang.net/articles/1685327175.html

posted @ 2023-05-29 19:33  kaiser099  阅读(132)  评论(0编辑  收藏  举报