在JS中有这种用法,某个函数名可以当成参数的形式,传入到另外一个函数内部去,例如:
<scripttype="text/javascript">
<!--
functionmyFuncA(str,myFuncB){
str=str+"您好!";
str=myFuncB(str);
returnstr;
}
functionmyFuncB(str){
str=str+"欢迎来到IECN.NET";
returnstr;
}
alert(myFuncA("张三",myFuncB));
//-->
</script>
在VBScript有两种方式可以来实现,即用execute或GetRef函数。
一、利用execute:
<scriptlanguage=vbscript>
FunctionmyFuncA(str,myFuncName)
str=str&"您好!"
execute("str="&myFuncName&"(str)")
myFuncA=str
EndFunction
FunctionmyFuncB(str)
str=str+"欢迎来到IECN.NET"
myFuncB=str
EndFunction
msgboxmyFuncA("张三","myFuncB")
</script>
二、利用GetRef:
<scripttype="text/vbscript">
FunctionmyFuncA(str,myB)
str=str&"您好!"
str=myB(str)
myFuncA=str
EndFunction
FunctionmyFuncB(str)
str=str+"欢迎来到IECN.NET"
myFuncB=str
EndFunction
document.write(myFuncA("张三",GetRef("myFuncB")))
</script>
