Is it possible to call a VBScript function from a JavaScript call, or alternately call JavaScript from a VBScript call?
是否可以从JavaScript调用中调用VBScript函数,或者从VBScript调用中调用JavaScript?
3 个解决方案
#1
Yes, if your main script is a Windows Script File (WSF).
是的,如果您的主脚本是Windows脚本文件(WSF)。
WSF files can include other script files and execute code from multiple engines.
WSF文件可以包含其他脚本文件并从多个引擎执行代码。
#2
Calling a VBScript function from Javascript
从Javascript调用VBScript函数
Your VBScript:
Function myVBFunction()
' here comes your vbscript code
End Function
Your Javascript:
function myJavascriptFunction(){
myVBFunction(); // calls the vbs function
}
window.onload = myJavascriptFunction;
Calling a Javascript function from VBScript
从VBScript调用Javascript函数
Function myVBFunction()
myJavascriptFunction()
End Function
#3
This is also possible within HTA's by specifying the language when the function is called, like this:
通过在调用函数时指定语言,这也可以在HTA中实现,如下所示:
<input id="renameIcon" name="renameIcon" type="image" src="images/rename.ico" onclick=renameUser() onmouseover='vbscript: if showStat <> "busy" Then call showStatus(button4.title)' onmouseout='vbscript: if showStat <> "busy" Then call showStatus("")'>
see here for a more in depth example: http://docs.google.com/Doc?id=ajh85hfcbjj6_457g7v6fgfh
请参阅此处以获取更深入的示例:http://docs.google.com/Doc?id = ajh85hfcbjj6_457g7v6fgfh
#1
Yes, if your main script is a Windows Script File (WSF).
是的,如果您的主脚本是Windows脚本文件(WSF)。
WSF files can include other script files and execute code from multiple engines.
WSF文件可以包含其他脚本文件并从多个引擎执行代码。
#2
Calling a VBScript function from Javascript
从Javascript调用VBScript函数
Your VBScript:
Function myVBFunction()
' here comes your vbscript code
End Function
Your Javascript:
function myJavascriptFunction(){
myVBFunction(); // calls the vbs function
}
window.onload = myJavascriptFunction;
Calling a Javascript function from VBScript
从VBScript调用Javascript函数
Function myVBFunction()
myJavascriptFunction()
End Function
#3
This is also possible within HTA's by specifying the language when the function is called, like this:
通过在调用函数时指定语言,这也可以在HTA中实现,如下所示:
<input id="renameIcon" name="renameIcon" type="image" src="images/rename.ico" onclick=renameUser() onmouseover='vbscript: if showStat <> "busy" Then call showStatus(button4.title)' onmouseout='vbscript: if showStat <> "busy" Then call showStatus("")'>
see here for a more in depth example: http://docs.google.com/Doc?id=ajh85hfcbjj6_457g7v6fgfh
请参阅此处以获取更深入的示例:http://docs.google.com/Doc?id = ajh85hfcbjj6_457g7v6fgfh