猜你的屬相

- 中國WEB開發者網絡 (http://www.webasp.net)
-- 網頁特效 (http://www.webasp.net/javascript/)
--- 猜你的屬相 (http://www.webasp.net/javascript/1/4.htm)
-- 發佈日期: 2004-05-24
<!-- 網頁特效代碼由[中國WEB開發者網絡:http://www.ChinaWebDev.com]提供! -->
<!-- 要實現此效果需要 1 個步驟: -->

<!-- 第 1 步: -->
<!-- 把下面的代碼加到<BODY></BODY>區域中: -->

<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>
<FORM name=frm>
出生年份:<INPUT name=inyear size=4 value=1975> <BR><INPUT onclick=getpet() type=button value=看看屬什麼><INPUT name=birth size=9></FORM>


webasp.net