请教ASP中SUB的一些问题,谢谢。

来源:百度知道 编辑:UC知道 时间:2024/06/07 22:42:46
<%
call mm()
call oo()

sub mm()
g="11"
h="22"
end sub

sub oo()
response.write g&"aa"
response.write h&"bb"
end sub
%>

我希望结果是
11aa22bb

但却是
aabb

本人初学,不太懂,请大家指点一下,谢谢。

g h两个变量属于mm()子过程,在oo()过程中无法访问到子过程中的变量 所以结果是 g和h是空的.
如何解决:

g和h定义变量 需要在sub waib定义,这样其它过程才能使用.
如:
dim g as string
dim h as string
sub mm()
g="11"
h="22"
end sub

<%
dim g,h
call mm()
call oo()