2013年9月25日 星期三

傳入生日找出相對應的星座

<%
Function GetBirthdayStar(Birhday)
 '水(寶)瓶座 ( 01.20 - 02.18 )
 '雙魚座 ( 02.19 - 03.20 )
 '牡(白)羊座 ( 03.21 - 04.20 )
 '金牛座 ( 04.21 - 05.20 )
 '雙子座 ( 05.21 - 06.21 )
 '巨蟹座 ( 06.22 - 07.22 )
 '獅子座 ( 07.23 - 08.22 )
 '處女座 ( 08.23 - 09.22 )
 '天秤座 ( 09.23 - 10.22 )
 '天蠍座 ( 10.23 - 11.21 )
 '射手座 ( 11.22 - 12.21 )
 '摩羯座 ( 12.22 - 01.19 )
 atomBound =array("0120","0219","0321","0421","0521","0622","0723","0823","0923","1023","1122","1222")
 atoms = array("魔羯座", "水瓶座", "雙魚座", "牡羊座", "金牛座", "雙子座", "巨蟹座", "獅子座", "處女座", "天秤座", "天蠍座", "射手座")
 for i=0 to UBound(atomBound)
  if CStr(Birhday) < CStr(atomBound(i)) then
   'response.write  Birhday&"-"&atomBound(i)
   GetBirthdayStar= atoms(i)
   exit for
  else
   GetBirthdayStar="魔羯座"
  end if
 next
end Function
response.write GetBirthdayStar("0329")     '傳入的格式為四字元字串
%>