正 文

在asp中使用类,实现模块化


www.7dspace.com  更新日期:2005-10-23 0:48:54  七度空间


这里有个killint函数,是判断数据合法性的,它的原形是:

Private Function killint(i,killstr,killsub)
If Not IsNumeric(i) Then
i=killstr
ElseIf i<=0 Then
i=killsub
End if
killint=Int(Left(i,5))
End Function

该函数功能很明确,不再繁琐说。

由于我们要通过积分判断用户级别,这里定义了一个私有函数:

Private Function getlevel()
bpoint=killint(bpoint,0,0)
If bpoint<500 Then
blevel="初级会员"
ElseIf bpoint>=500 And bpoint<=100 Then
blevel="高级会员"
Else
blevel="终极会员"
End If
Getlevel=blevel
End Function

我们要得是回送用户的信息,必须定义一个public公用函数,显示信息:

Public Function showuser()
response.write("<h5>以下显示<font color=red>"&bname&"</font>的资料:</h5>")
response.write("<h5>性别:<font color=red>"&bsex&"</font></h5>")
response.write("<h5>积分:<font color=red>"&bpoint&"</font></h5>")
getlevel
response.write("<h5>级别:<font color=red>"&blevel&"</font></h5>")
End Function
End class

使用这个类的时候这样使用:(我在这里写了一个表单处理的)

Set blueideauser=new blueidea
blueideauser.getname=Trim(request("id"))
blueideauser.getsex=request("sex")
blueideauser.getpoint=request("point")
blueideauser.showuser

是不是想看看效果,那就看看这里:
http://www.5do8.com/net/aspclass/class.asp

4页,页码:[1] [2] [3] [4] 

上一篇:用PS打造超级变幻线简明教程
下一篇:入侵服务器详解
作者:5do8  来源:蓝色理想 ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐