首页 > 开发 > .Net > 正文

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

2020-02-03 16:41:20
字体:
来源:转载
供稿:网友
下面给出一个完成的函数,仔细的体会一下。
function getconditions(strcity : string) : string
{
   var now : date = new date();
   switch (strcity.touppercase())
   {
   case "london":
      if (now.getmonth() <= 7 || now.getmonth() >= 9)
      {
         return "overcast";
      }
      else
      {
         return "partly overcast and humid";
      }
      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";
   }
}
    使用jscript.net,你也可以定义其他.net架构的类型,通过引用命名空间和派生类可以向jscript.net引入新的数据类型。这样在两者的数据类型中就有可能产生重叠。参见下表:
boolean    .net framework boolean / jscript boolean
number    .net framework double / jscript number
string    .net framework string / jscript string
int    .net framework int32
long    .net framework int64
float    .net framework single
double    .net framework double
object    .net framework object / jscript object
date    jscript date object
array    jscript array
function    jscript function object


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