[高分请教]--在ActiveX中能不能调用脚本文件(.JS)--[高分请教] 直接用Script Control(推荐)或者用PROGID为"JScript"返回IActiveScript(强烈不推荐,过程复杂) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哦。。我自己做了个也忘记了。http://lostinet.d2g.com/temp/RunJScriptWSC.zip 把wb.js的代码封装在*.wsc的文件中,然后注册,就可以当作ActiveX的控件来调用了。{……-……}给一个*.wsc例子:<?XML version="1.0"?><package><component id="component1"><registration progid="Component.FrontEnd"/><public> <property name="math"/> <property name="WScript0"/></public><script language="JScript"><![CDATA[var math = createComponent("component2");var WScript0 = new ActiveXObject("WScript.Shell");]]></script></component><component id="component2"><registration progid="Component.Math"/><public> <method name="add"/> <method name="multiply"/></public><script language="JScript"><![CDATA[function add(n1, n2){ return n1+n2;}function multiply(n1, n2){ return n1*n2;}]]></script></component></package>下面是利用上边的注册过后的测试脚本:' Creates instance of first script component.set o1 = CreateObject("Component.FrontEnd")' Invokes the second script component's functions directly.msgbox(o1.WScript0.SpecialFolders("Desktop"))'msgbox(o1.WScript0)msgbox(o1.math.add(3,5))'msgbox(o1.math.multiply(3,5))' Creates a second object that references the math method directly.Set o2 = o1.math'msgbox(o2.add(4,5))'msgbox(o2.multiply(4,5)) js的这种写法是什么意思? 事件绑定问题,知道标准事件模型的进来帮我解决一下 jQuery插件编写,调用函数的this指针应该怎样处理? 请问用JS 如何把如文中这样复杂的表格输入到WORD中。谢谢!最好有源代码。 Jscript问题,请高手指点,最好给出代码 关于往iframe里面写内容 如何取得showModalDialog的返回值呢? Javascript中的数组是否有大小限制? 如何获得历史记录的URL,各位高手给些高见! 获得子节点元素的方法 天哪,这就是我画的甘特图*@_@* 如何在JAVASCRIP中实现特定字符串替换?
我自己做了个也忘记了。
http://lostinet.d2g.com/temp/RunJScriptWSC.zip
给一个*.wsc例子:
<?XML version="1.0"?>
<package>
<component id="component1">
<registration progid="Component.FrontEnd"/>
<public>
<property name="math"/>
<property name="WScript0"/>
</public>
<script language="JScript">
<![CDATA[
var math = createComponent("component2");
var WScript0 = new ActiveXObject("WScript.Shell");
]]>
</script>
</component><component id="component2">
<registration progid="Component.Math"/>
<public>
<method name="add"/>
<method name="multiply"/>
</public>
<script language="JScript">
<![CDATA[
function add(n1, n2){
return n1+n2;
}
function multiply(n1, n2){
return n1*n2;
}
]]>
</script>
</component>
</package>
下面是利用上边的注册过后的测试脚本:
' Creates instance of first script component.
set o1 = CreateObject("Component.FrontEnd")' Invokes the second script component's functions directly.
msgbox(o1.WScript0.SpecialFolders("Desktop"))
'msgbox(o1.WScript0)
msgbox(o1.math.add(3,5))
'msgbox(o1.math.multiply(3,5))' Creates a second object that references the math method directly.
Set o2 = o1.math
'msgbox(o2.add(4,5))
'msgbox(o2.multiply(4,5))