Home >Web Front-end >JS Tutorial >Code for zodiac query implemented using js

Code for zodiac query implemented using js

PHP中文网
PHP中文网Original
2016-05-16 18:10:041676browse

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<title>生肖查询</title> 
<style type="text/css"> 
<!-- 
td,body {font-size:12px} 
a:link {color:#000000;text-decoration:none} 
a:visited {color:#000000;text-decoration:none} 
a:active {color:blue;text-decoration:none} 
a:hover {color:red;text-decoration:underline} 
a.title:link {color:#000000;text-decoration:underline} 
a.title:visited {color:#000000;text-decoration:underline} 
a.title:active {color:#0000ff;text-decoration:underline} 
a.title:hover {color:#0000ff;text-decoration:underline} 
--> 
</style> 
<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> 
</head> 
<table width="760" height="22" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#aaaaaa" bordercolordark="#ffffff"> 
<tbody> 
<tr> 
<td height="20" align="center"><table width="100%" border="0"> 
<tr> 
<td width="54%"><b><font color="#424242"><strong><font color="#424242">目前位置>><a href="/" target="_self">首页</a>></font></strong></font><a href="/tools" target="_self">实用查询</a>>生肖查询</b></td> 
<td width="46%"> </td> 
</tr> 
</table></td> 
</tr> 
</tbody> 
</table> 
<table width="760" border="0" align="center" cellspacing="0"> 
<tr> 
<td width="760" height="10"></td> 
</tr> 
</table> 
<DIV align=center><span class="style2"> 
生肖查询</span></div> 
<P align=center> 
<FORM name=frm> 
<div align="center">生于:   
<INPUT size=4 value=1986 name=inyear> 
  年   
<INPUT onclick=getpet() type=button value=查看生肖> 
   属:  
<INPUT size=3 
name=birth> 
</div> 
</FORM><TR> 
<TD width="100%" height="6" align="center" bgcolor="#FFFFFF"><FONT color=#ff0000>  </TD> 
</TR> 
<TR> 
<TD 
align="center" height="5" width="100%"> </TD> 
</TR></P> 
<div align="center"><span class="style1">当然没有人回忘记自己属什么。。但是你可以很轻松得知道任何年份出世得人的属相。。填入查询出生在哪一年,例如:"1986"</span> 
</div> 
<p> </p> 
</body> 
</html>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn