使用JScript.NET创建asp.net页面(七)
发布时间:2006-10-14 2:58:18   收集提供:gaoqian
例子2
<%@ WebService Language="JScript" class="Weather"%>
import System
import System.Web.Services
class Weather {
   WebMethodAttribute function getConditions(strCity : String) : String
   {
   var now = new Date();
   switch (strCity.toUpperCase())
   {
         case "LONDON":
            if (now.getMonth() <= 7||now.getMonth() >=9)
            {
               return "overcast"
            }
            if
            {
               return "partly overcast"
            }
            break;
         case "SEATTLE":
            if (now.getMonth() == 7 && now.getDay()==4)
            {
               return "torrential rain"
            }
            else
            {
               return "rain"
            }
            break;
         case "LA":
            return "smoggy"
            break;
         case "PHOENIX":
            return "damn hot"
            break;
         default:
            return "partly cloudy with a chance of showers"
      }
   }
}


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50