您如何设置JScript(NOT JScript.NET)开发环境? [英] How do you set up your JScript (NOT JScript.NET) development environment?

查看:77
本文介绍了您如何设置JScript(NOT JScript.NET)开发环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的环境中,如果我使用JScript语法创建一个类:

In my environment, if I create a class in JScript syntax:

class test{

}

,然后将其保存到名为 test.js的文件中,并使用wscript运行它,我在第1行收到一个Microsoft JScript语法错误。

and then save it to a file named "test.js" and run it with wscript, I get a Microsoft JScript "Syntax error" at line 1.

但是,如果我只是简单地说一个函数:

However, if I simply, say, write a function:

  function getInput() {

   var wshell = WScript.CreateObject("WScript.Shell");
   wshell.Popup ("Do you want to continue?");

   return userInput
}

getInput()

并以相同的方式运行,它可以正常工作。

and run it the same way, it works.

希望,我的类定义存在根本性的错误。如果是这样,我很高兴能找到答案。

Hopefully, there is something fundamentally wrong with my class definition. If that is the case, I am excited to find out.

推荐答案

JScript只是Microsoft对 JavaScript / ECMAScript。因此,它没有类,也没有任何其他添加到JScript.NET的东西使它有点适合.NET。

JScript is just Microsoft's implementation of JavaScript/ECMAScript. As such, it doesn't have classes, or any of the other things added to JScript.NET to make it kinda-sorta fit into .NET.

忽略JScript。 NET,并在 JScript的WSH版本中进行阅读。

Ignore JScript.NET, and read up on the WSH version of JScript.

这篇关于您如何设置JScript(NOT JScript.NET)开发环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆