标题: 如何返回函数中的变量 [打印本页] 作者: shuishixingyu 时间: 2009-4-23 16:36 标题: 如何返回函数中的变量 Dim str_obj
Dim str_property
Dim str_type
Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set objTemp = str_obj.ChildObjects(oDesc)
NumberOfList = objTemp.Count
End Function
Function get_property(str_obj,obj_property)
str_property = str_obj.GetRoProperty(obj_property)
End Function
对于
Function get_property(str_obj,obj_property)
str_property = str_obj.GetRoProperty(obj_property)
End Function
只需要一个参数啊
Function get_property(obj_property)
dim str_obj
set str_obj=get_object( "micclass",Browser("**").Page("**").Frame("mainboard"),"WebEdit")
str_property = str_obj.GetRoProperty(obj_property)
End Function
我没有测试,自己调试下了。作者: ddkfamily 时间: 2009-4-23 20:16
Dim str_obj
Dim str_property
Dim str_type
Dim obj_Temp
Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set objTemp = str_obj.ChildObjects(oDesc)
NumberOfList = objTemp.Count
get_object = str_obj.ChildObjects(oDesc)
End Function
obj_Temp = get_object(micclass,str_obj,str_type)
Function get_property(obj_Temp,obj_property)
str_property = str_obj.GetRoProperty(obj_property)
End Function
Call get_object( "micclass",Browser("**").Page("**").Frame("mainboard"),"WebEdit")作者: 风雪夜归人 时间: 2009-4-23 22:51
真的不要用Call,直接函数名就可以了作者: shuishixingyu 时间: 2009-4-24 10:49 标题: 按照virgolong的方法 Dim str_obj
Dim str_property
Dim str_type
Public Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set objTemp = str_obj.ChildObjects(oDesc)
' NumberOfList = objTemp.Count
Set get_object = objTemp
End Function
Function get_property(obj_property)
Dim str_obj
Set str_obj=get_object( "micclass",Browser("**").Page("**").Frame("mainboard"),"WebEdit")
str_property = str_obj.GetRoProperty(obj_property)
End Function
在 str_property = str_obj.GetRoProperty(obj_property) 处显示如图[attach]51189[/attach][attach]51189[/attach]作者: shuishixingyu 时间: 2009-4-24 10:56 标题: 按照ddkfamily的方法 Dim str_obj
Dim str_property
Dim str_type
Dim obj_Temp
Public Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set objTemp = str_obj.ChildObjects(oDesc)
' NumberOfList = objTemp.Count
get_object = objTemp
End Function
obj_Temp = get_object(micclass,str_obj,str_type)
Function get_property(str_obj,obj_property)
str_property = str_obj.GetRoProperty(obj_property)
End Function
Call get_object("micclass",Browser("**").Page("**").Frame("mainboard"),"WebEdit")
call get_property(obj_Temp,"name")
在 oDesc(micclass).Value = str_type处显示语法错误
估计是obj_Temp = get_object(micclass,str_obj,str_type)这句的原因作者: virgolong 时间: 2009-4-24 11:59
不好意思,考虑到重用性,get_property还是应该有两个参数,第一个参数从get_object来
Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set get_object = str_obj.ChildObjects(oDesc)
End Function
Function get_property(str_obj,obj_property)
get_property= str_obj.GetRoProperty(obj_property)
End Function
Function get_property(str_obj,obj_property)
get_property = str_obj.GetRoProperty(obj_property)
End Function作者: shuishixingyu 时间: 2009-4-25 18:22
仍然出现上述错误,请问版主是这么写的吗?
Dim str_obj
Dim str_property
Dim str_type
Function get_object(micclass,str_obj,str_type)
Dim oDesc
Set oDesc = Description.Create()
oDesc(micclass).Value = str_type
Set get_object = str_obj.ChildObjects(oDesc)
' NumberOfList = objTemp.Count
End Function