請輸入您出生的西元年例如: "1975"

十二生肖

將下列程式碼複製至<head>程式碼</head>區內

<script LANGUAGE="JavaScript">
<!--
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;

}
// -->
</script>
<p align="center"><font size="2">請輸入您出生的西元年例如: "1975"</font></p>
<form NAME="frm">
<p align="center"><input TYPE="text" SIZE="4" NAME="inyear" value="1975"> <input TYPE="button" VALUE="您的幸運生肖" onClick="getpet()">
<input TYPE="text" SIZE="9" NAME="birth">
</p>
</form>