首页 > 编程 > .NET > 正文

使用JScript.NET创建asp.net页面(七)

2024-07-10 12:58:10
字体:
来源:转载
供稿:网友
例子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"
      }
   }
}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表