用js实现的生肖查询的代码
程序员文章站
2022-04-28 07:59:19
...
<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>
上一篇: HTML 属性
推荐阅读
-
用js进行url编码后用php反解以及用php实现js的escape功能函数总
-
js下通过prototype扩展实现indexOf的代码_javascript技巧
-
js 实现倒计时效果的实例代码分享
-
js实现文字左右滑动的代码
-
用PHP实现的随机广告显示代码_PHP教程
-
js实现点小图看大图效果的思路及示例代码_javascript技巧
-
用php实现类似淘宝,拍拍,易趣的最近浏览商品的功能模型代码,该如何处理
-
mysql多表联合查询返回一张表的内容实现代码
-
JS类的封装及实现代码_js面向对象
-
Spring boot + mybatis + Vue.js + ElementUI 实现数据的增删改查实例代码(一)