Initialize 事件 怎不执行 ?

kingapex1 2004-08-20 11:49:48
比如 :

class FileOperator

Private Sub FileOperator_Initialize()
response.write "dd"
End Sub

end class


set aFO = new FileOperator



set aFO = Nothing



why ?
...全文
351 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2004-09-02
  • 打赏
  • 举报
回复
js就要好的多。不过那个用function做的类看着别扭啊

我觉得js为了代码精简混淆了函数和类的概念而已
huhanshan013 2004-08-21
  • 打赏
  • 举报
回复
body 中 onload="Initialize ()"
-神仙- 2004-08-21
  • 打赏
  • 举报
回复
奇怪了
我用着怎么是好的
kingapex1 2004-08-21
  • 打赏
  • 举报
回复
to efei(草不含羞)(J2ME,我来了……)


Class_Initialize() 可能只有在 脚本vbs里好用吧
我在服务器端怎么也不好用。

哎。。以后再研究吧。。。
mjpclab 2004-08-21
  • 打赏
  • 举报
回复
class FileOperator

Private Sub New()
response.write "dd"
End Sub

end class
efei 2004-08-21
  • 打赏
  • 举报
回复
http://www.wuyouschool.com.cn/public/efei/TreeView.chm


这个我没看到类 啊
==========================================================

这个你没看到类?首页里有个连接,点一下就可以了。
或者直接这里:
http://www.wuyouschool.com.cn/public/efei/treeview.vbs
efei 2004-08-21
  • 打赏
  • 举报
回复
楼主,你凭什么说初始化事件在服务器端运行时没有运行?
我严重怀疑你在里面msgbox了,呵呵

给个例子吧:

<script language="vbscript" runat="server">
Class book
Private bookName
Private Sub Class_Initialize()
bookName = "efei"
End Sub

Public Function getBookName()
getBookName = bookName
End Function
End Class
</script>

<%
Dim b
Set b = New book
Response.Write b.getBookName
Set b = Nothing
%>

不要使来找我,呵呵
kingapex1 2004-08-20
  • 打赏
  • 举报
回复
to syre(神仙)

我是 set fo=new FileOperator

不信你试一下,
都郁闷了
-神仙- 2004-08-20
  • 打赏
  • 举报
回复
vbs就是弱啊。
js就要好的多。不过那个用function做的类看着别扭啊
-神仙- 2004-08-20
  • 打赏
  • 举报
回复
sorry,是
Sub Class_Initialize
你的class怎么用的
因该是
set fo=new FileOperator
kingapex1 2004-08-20
  • 打赏
  • 举报
回复
谢楼上的你那个东东挺好,

你的意思

class FileOperator

private Sub class_Initialize()
response.write "dd"
End Sub

end class


这样可以了吧,
但我实验的结果还是不行
超级大笨狼 2004-08-20
  • 打赏
  • 举报
回复
<input value="看看superDullWolf的CNWord类引用实例,vbs,改进了一下,可以提供chinese出现的位置了" id="input1" style="width:100%"/>
<br/>
<button onclick="vbs:classAndRegExp">验证</button>
<script language = "vbscript">
sub classAndRegExp()
set wolf = new CNWord
wolf.str = input1.value

msgbox "含有中文数" & wolf.CNcount
msgbox "含有中文块数" & wolf.CNBlockCount
msgbox "第2个中文块是--->" & wolf.CN(2)
msgbox "第1个中文块出现的位置是--->" & wolf.CNIndex(1)
set wolf = nothing
end sub
</script>


<script language="vbscript">
class CNWord

public str

private sub Class_Initialize()
set regEx =new RegExp
regEx.IgnoreCase = True '设置是否区分大小写。
regEx.Global = True '设置全局可用性。
end sub

private regEx


Property get CN(x)
dim Arr()
dim maxBound : maxBound = CNBlockCount
redim Arr(maxBound)
dim i:i=1
dim Match
For each Match in regEx.Execute(str)
Arr(i) = Match
i = i + 1
next
if x<=maxBound then CN = Arr(x)
End Property

Property get CNIndex(x)
dim Arr()
dim maxBound : maxBound = CNBlockCount
redim Arr(maxBound)
dim i:i=1
dim Match
For each Match in regEx.Execute(str)
Arr(i) = Match.FirstIndex + 1
i = i + 1
next
if x<=maxBound then CNIndex = Arr(x)
End Property

Property get CNcount
'返回含有中文的字数
regEx.Pattern = "[\u4e00-\u9fa5]"
CNcount = findCHNnum()
End Property

Property get CNBlockCount
'返回含有中文的块数
regEx.Pattern = "[\u4e00-\u9fa5]+"
CNBlockCount = findCHNnum()
End Property


private function findCHNnum()
findCHNnum = regEx.Execute(str).count
end function




private sub Class_Terminate()
set regEx = nothing
end sub

end class
</script>
kingapex1 2004-08-20
  • 打赏
  • 举报
回复
谁知道怎么回事 ?
kingapex1 2004-08-20
  • 打赏
  • 举报
回复
response 对象也要声明 ?
king2003 2004-08-20
  • 打赏
  • 举报
回复
靠这能执行吗RESPONSE对象就没有声明拿什么执行
kingapex1 2004-08-20
  • 打赏
  • 举报
回复
class FileOperator

Sub Initialize()
response.write "dd"
End Sub

end class


这个不好用啊


http://www.wuyouschool.com.cn/public/efei/TreeView.chm


这个我没看到类 啊

麻烦谁给个例子

efei 2004-08-20
  • 打赏
  • 举报
回复
在VB里它就叫初始化事件,而不是构造函数,呵呵。

真的谈不上构造,没有参数,不能重载,你还期望什么
-神仙- 2004-08-20
  • 打赏
  • 举报
回复
这个是构造函数,不是什么事件回调函数
-神仙- 2004-08-20
  • 打赏
  • 举报
回复
class FileOperator

Sub Initialize()
response.write "dd"
End Sub

end class
efei 2004-08-20
  • 打赏
  • 举报
回复
http://www.wuyouschool.com.cn/public/efei/TreeView.chm

这个树是用vbscript的Class写的,参考一下了
加载更多回复(2)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧