• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

简单asp类模仿

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 12次 | 进入软件测试论坛讨论

领测软件测试网 现在才发现asp里面也可以自己写一些类,而且基本上和其他语言差不多,所以就自己写了一个试试,嘿嘿!纪年一下!
<%
Class clsDSJ
Private p_Error,p_Author,p_WebURL

Public Property Get Version
Version="DSJ 1.0.0 Beta"
End Property

Public Property Get Error
Error=p_Error
End Property

Public Property Get Author
Author=p_Author
End Property

Public Property Let Author(strAuthor)
strAuthor=Trim(strAuthor)
If strAuthor="" Then
p_Author="孤剑"
Else
p_Author=CStr(strAuthor)
End If
End Property

Public Property Get WebURL
WebURL=p_WebURL
End Property

Public Property Let WebURL(URL)
URL=Trim(URL)
If URL="" Then
p_WebURL="http://www.blog.csdn.net/alonesword/"
ELse
If LCase(CStr(Left(URL,7)))<>"http://" then
p_WebURL="http://" & URL
Else
p_WebURL=URL
End If
End If
End Property

Private Sub Class_Initialize
p_Author="孤剑"
WebURL="http://www.blog.csdn.net/alonesword/"
p_Error=-1


End Sub

Private Sub Class_Terminate

End Sub

Public Function gotTopic(str,strlen)
Rem 限制字符串显示长度在一定的范围内
Dim i,StringLen,CharSize,EchoCharType
StringLen=len(str)
CharSize=0
For i=1 to StringLen
EchoCharType=Abs(Asc(Mid(str,i,1)))
If EchoCharType>255 Then
CharSize=CharSize+2
Else
CharSize=CharSize+1
End If
If CharSize>strlen Then
gotTopic=Left(str,i) & "..."
Exit For
Else
gotTopic=str & ""
End If
Next
End Function

‘’******************************
‘’名称: ChkInvaildWords
‘’参数:Words
‘’返回值:True/Falsh
‘’作用:检查参数是否有非法字符
‘’******************************
Function ChkWords(Words)
Rem 定义需要过滤得非法字符
Const InvaildWords="select|update|delete|insert|@|--|,|‘’|#|%"
ChkWords=True
InvaildWord=Split(InvaildWords,"|")
inWords=LCase(Trim(Words))

For i=LBound(InvaildWord) To UBound(InvaildWord)
If Instr(inWords,InvaildWord(i))>0 Then
p_Error=0
ChkWords=False
Exit Function
End If
Next
ChkWords=True
End Function

Function DividedPage(objRs,perPageSize,CurrentPage)
objRs.Pagesize=perPageSize
TotalPage=objRs.PageCount

If IsEmpty(perPageSize) Or IsEmpty(CurrentPage) Then
p_Error=1
Response.Write("<Font style=‘’font-size:12px;‘’>参数不能为空!<br></Font>")
Response.End()
Exit Function
ElseIf (IsNumeric(perPageSize)=false Or IsNumeric(CurrentPage)=false) then
p_Error=2
Response.Write("<Font style=‘’font-size:12px;‘’>参数不能为空!<br></Font>")
Response.End()
Exit Function
End If

If CLng(CurrentPage)<1 Then CurrentPage=1 End If
If CLng(CurrentPage)>TotalPage Then CurrentPage=TotalPage End If

If TotalPage>0 Then
objRs.AbsolutePage=CurrentPage
End If

Items=1
Do While Not objRs.Eof
Response.Write(Items)
objRs.MoveNext
Loop
End Function ‘’终止于2004年11月27日

End Class

Dim DSJ
Set DSJ=New clsDSJ
%>

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网