最新下载
热门教程
- 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
- 《寓言之地》1.02更新内容一览 05-17
- 《辐射4》steam好评率介绍 05-17
- 《夜族崛起》技能强化珠宝掉落说明 05-17
- 《辐射4》主机控制台介绍 05-17
- 《星露谷物语》海草和绿藻获取方法 05-17