当前位置: 首页 > 图文教程 > 网络编程 > ASP > 在VBScript中使用类(四)

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

ASP 中的 在VBScript中使用类(四)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 169 ::
收藏到网摘: n/a

    现在的代码离我们想要的还是有些不太实用,我们将在其他页使用类TVProgram,因此最好将其独立定义,以便所有也面都可以调用。创建一个ASP页面,并命名为TVProgramClass.asp,我们在其中定义类TVProgram。

--TVProgramClass.asp--

<%

        Class TVProgram

               Private internal_StartTime

 

               Public Property Get StartTime

                       StartTime = Hour(internal_StartTime) & _

                               ":" & Minute(internal_StartTime)

               End Property

 

               Public Property Let StartTime(ByVal varTimeIn)

                       If IsDate(varTimeIn) Then

                               internal_StartTime = varTimeIn

                       End If

               End Property

 

               Private internal_ProgramDate

 

               Public Property Get ProgramDate

                       ProgramDate = Day(internal_ProgramDate) & _

                               " " & MonthName(Month(internal_ProgramDate)) & _

                               " " & Year(internal_ProgramDate)

               End Property

 

               Public Property Let ProgramDate(ByVal varDateIn)

                       If IsDate(varDateIn) Then

                               internal_ProgramDate = varDateIn

                       End If

               End Property

 

               Public ProgramTitle

        End Class

%>

这样就可以在任何ASP中调用我们定义的类了,语法如下:

<!-- #include virtual="TVProgramClass.asp" -->
<%

        Dim objTVShow