How can I use Javascript OO classes from VBScript, in an ASP-Classic or WSH environment?

I know [I can call top-level functions defined in JS from VBScript][1], and vice versa, like this: <%@ language="Chakra" %> I can also include JS into VBScript modules, like this: <%@ language="VBScript" %> ...and the functions defined in the includedModule.js are available in the VBScript. But suppose I have a Javascript class defined using prototypal OO, like this: (function() { MyObj = function() { this.foo = ... ... }; MyObj.prototype.method1 = function() { .. }; MyObj.prototype.method2 = function() { .. }; }()); How can I use that object (aka type, or class) from VBScript? The vanilla approach... Dim foo Set foo = New MyObj ...does not work. Neither does Dim foo foo = MyObj() ...because apparently `this` is not defined when the JS function is invoked from VBScript. Or something. So how can I do it? The reason this is valuable: there are OO libraries available in Javascript, that would be interesting to use from VBScript. [1]: http://phrogz.net/tmp/serversidejsandvb.html
duplicate? Can I initialize objects written in JScript from VBScript?

以上就是How can I use Javascript OO classes from VBScript, in an ASP-Classic or WSH environment?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏