教学之友,学习之友。

站长教学网

当前位置: 站长教学网 > 网站编程 > ASP教程 >

ASP根据出生日期转换成对应的星座函数

时间:2012-03-31 00:26来源:未知 作者:ken 点击:

经常在一些社交网站上可以看到某个用户所属的星座,这里介绍一个asp函数,用来读取用户的生日,来显示他所属的星座。
代码如下:

这个asp函数的使用方法

<%
response.write astro("1988-8-8")
%>

  1. '日期转换星座函数,参数是日期型  
  2. function astro(birth)  
  3. astro="" 
  4. if birth="" or not isdate(birth) Then exit function  
  5. birthmonth=month(birth)   
  6. if birthmonth<10 then birthmonth="0" & birthmonth  
  7. birthday=day(birth)   
  8. if birthday<10 then birthday="0" & birthday  
  9. birth=trim(birthmonth & birthday) '重整月日,0903型  
  10.  
  11. rAstro=split("水瓶座*0120*0219#双鱼座*0220*0320#白羊座*0321*0420#金牛座*0421*0521#双子座*0522*0621#巨蟹座*0622*0722#狮子座*0723*0823#处女座*0824*0923#天秤座*0924*1023#天蝎座*1024*1122#射手座*1123*1222#摩蝎座*1222*0119#","#")  
  12.  
  13. astro="摩蝎座" '这个是跨年的,不好对比,先默认  
  14. for i_ls=0 to ubound(rAstro)-2  
  15.  rls2=split(rAstro(i_ls) & "*","*")  
  16.  if birth>=rls2(1) and birth<=rls2(2) then  
  17.   astro=rls2(0)  
  18.   exit for  
  19.  end if  
  20. next  
  21. end function 

 

(责任编辑:ken)
TAG标签: asp
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
注册登录:不允许匿名留言,登录后留言无需输入验证码。
栏目列表
最新内容