最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
VBSctipt 5.0中的新特性
时间:2022-06-30 09:41:17 编辑:袖梨 来源:一聚教程网
VBSctipt 5.0中的新特性
能够在ASP中应用的特性包括了那些由脚本引擎所提供的特性,这意味着VBScript的改进也可在ASP中应用。VBScript的改进如下所述:
1、 在脚本中使用类
在VBScript中实现完整的VB类(class)模型,但明显的例外是在ASP服务器端的脚本事件。可以在脚本中创建类,使它们的属性和方法能够和用于页面的其余代码,例如:
Class MyClass
Private m_HalfValue 'Local variable to hold value of HalfValue
Public Property Let HalfValue(vData) 'executed to set the HalfValue property
If vData > 0 Then m_HalfValue = vData
End Property
Public Property Get HalfValue() 'executed to return the HalfValue property
HalfValue = m_HalfValue
End Property
Public Function GetResult() 'implements the GetResult method
GetResult = m_HalfVaue * 2
End Function
End Class
Set ObjThis = New MyClass
ObjThis.HalfValue = 21
Response.Write “Value of HalfValue property is “ & objThis.HalfValue & “
”
Response.Write “Result of GetResult method is “ & objThis.GetResult & “
”
…
这段代码产生如下结果:
Value of HalfValue property is 21
Result of GetResult method is 42
2、 With结构
VBScript 5.0支持With结构,使访问一个对象的几个属性或方法的代码更加紧凑:
…
Set objThis = Server.CreateObject(“This.object”)
With objThis
.Property1 = “This value”
相关文章
- 幻兽帕鲁面粉怎么得 05-17
- 少女前线云图计划开局阵容怎么搭配 05-17
- 微信网页版-微信网页版登录 05-17
- 鸣潮陆赫斯机制分析及抽取建议详情 05-17
- qq邮箱网页版登录-QQ邮箱网页版在线登录 05-17
- 天外世界2世界毁灭者成就如何完成 05-17