首页 > 开发 > .Net > 正文

使用JScript.NET制作asp.net网页基础教程7

2020-02-03 16:41:27
字体:
来源:转载
供稿:网友
例子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"
      }
   }
}


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