Javascript 只能用于网络浏览器吗?
我想了解 JavaScript。 Javascript 只能用于网络浏览器吗?因为我使用了一些 Javascript 代码来开发 Firefox 插件和 Thunderbird。
帮助我了解更多相关信息:除了网络浏览器之外,我可以在哪里使用 JavaScript,以及如何使用?
I would like to know about Javascript. Is Javascript available only for web browsers? Because I used some Javascript code for Firefox Plugin development and Thunderbird.
Help me to find out more about this: where can I use JavaScript other than web browsers, and how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
node.js 包含一个完整的网络服务器并在 Google 的 V8
There's node.js which includes a full webserver and runs on Google's V8
不!看看 Google 的 V8
No! Have a look at Google's V8
谷歌 JavaScript。单击第一个链接(维基百科)。单击“使用外部网页”。
http://en.wikipedia.org/wiki/JavaScript#Uses_outside_web_pages
Google Javascript. Click first link (Wikipedia). Click "uses outside webpages".
http://en.wikipedia.org/wiki/JavaScript#Uses_outside_web_pages
Javascript 有许多服务器端(或非浏览器)实现,包括 Node.js,它目前它背后有很大的动力,以及现已解散的 Jaxer,它提供了服务器端 DOM基于 Mozilla Gecko 的实现。还有一些努力将 DOM 类型功能引入 Node.js,主要来自 雅虎。
There are a number of server-side (or otherwise non-browser) implementations of Javascript, including Node.js, which currently has a lot of momentum behind it, as well as the now-defunct Jaxer, which provided a server-side DOM implementation based on Mozilla Gecko. There are also efforts to bring DOM type functionality to Node.js, primarily from Yahoo.
使用 Rhino,您可以将 Javascript 嵌入到 Java 应用程序中。
With Rhino, you can embed Javascript in Java applications.
不,肯定还有其他实现。例如,JScript.Net 包含在 .NET 框架中。
No, there are definitely other implementations. For instance, JScript.Net is included with the .NET framework.
MS-Windows 可以执行 .js 文件(从命令提示符)。
由于您没有浏览器上下文,因此您无法对浏览器进行任何调用(例如,
alert
不起作用)。查找“Windows 脚本宿主”。
MS-Windows can execute .js files (from the command prompt).
Since you do not have the browser context, you cannot use any calls to the browser (
alert
, for example, does not work).Look for "Windows Scripting Host".
独立的 Javascript 有多种实现方式
JSLibs (http://code.google.com/p/jslibs/) 是通用的目的
jsdb (http://www.jsdb.org/) 更面向数据库
There are several implementations of stand-alone Javascript
JSLibs (http://code.google.com/p/jslibs/) is general purpose
jsdb (http://www.jsdb.org/) is more database oriented
许多文本编辑器(包括我使用的 ActiveState 的 Komodo Edit)都会公开其 API,让您可以在 Javascript 中编写宏。
Many text editors (including the one I use, ActiveState's Komodo Edit) expose their APIs and let you write macros in Javascript.
使用 Adobe AIR,您可以使用 JavaScript 编写几乎独立于平台的桌面应用程序
Using Adobe AIR you can write almost platform-independent Desktop Applications using JavaScript
PDF 文件还可以包含 JavaScript 代码。请参阅Google 关于此主题的第一个条目以及Adobe JavaScript 病毒。
PDF files can also contain JavaScript code. See first entry in google on this subject and also Adobe JavaScript virus.
Javascript 可以轻松嵌入到用其他编程语言编写的应用程序中。
对于 Java,如前所述,有 Rhino,对于 C++,您可以使用例如 Flusspferd。 这里是一些教程/示例。
Javascript can be easily embedded in applications written in other programming languages.
For Java there is as already mentioned Rhino, for C++ you can use for example Flusspferd. Here are some tutorials/examples.
Qt 有 QtScript 模块。从 Qt 4.7 开始,它使用 JavaScriptCore(Webkit JavaScript 引擎)。
Qt has the QtScript module. From Qt 4.7 it uses JavaScriptCore (the Webkit JavaScript engine).
简而言之,不。
实际上,现在人们使用 Javascript 和其他 Web 技术来创建本机移动和桌面应用程序。(请参阅Titanium Appcelerator 和 PhoneGap)
如果您熟悉 KDE 项目,您可以使用 JavaScript 制作 Plasma 小部件,请参阅使用 JavaScript 创建等离子体
在 Qt 框架中有一个用于 JavaScript 的 QtScript 模块(ECMAScript) 应用程序脚本提供许多应用程序的功能。
还有即将在 Qt 4.7 是 Qt Quick,又名 Qt UI 创建工具包,它允许应用程序开发人员在 QML 中以声明方式定义其用户界面,有关更多信息,请访问 此处 和示例 此处
我们不要忘记 Javascript 在各种应用程序中用作嵌入式脚本语言 OpenOffice.org、Google 桌面小部件< /a> 以及许多其他内容,请参阅维基百科的文章此处
关于服务器端 Javascript允许后端访问数据库、文件系统等(请参阅 Node.js, Google V8、SpiderMonkey 及其他此处)
In short, No.
Actually, Javascript and other Web technologies are used these days to create native mobile and desktop applications. (see Titanium Appcelerator and PhoneGap)
If you are familiar with the KDE project you can craft Plasma widgets using JavaScript, see Creating plasmoids with JavaScript
In Qt framework there is a QtScript module for JavaScript (ECMAScript) application scripting to provide much of the application’s functionality.
Also the new technology that is soon to be released in Qt 4.7 is Qt Quick, aka the Qt UI Creation Kit, which allows application developers to declaratively define their user interfaces in QML, for more information go here and an example here
And let's not forget Javascript is used as an embedded scripting language in various applications OpenOffice.org, Google Desktop Widgets, and many others, see Wikipedia's article here
On the server-side Javascript enables back-end access to databases, file systems, etc (see Node.js, Google V8, SpiderMonkey and others here)
一些文档数据库,例如 CouchDB 和 MongoDB,使用JavaScript与数据库交互。
Some document databases, such as CouchDB and MongoDB, use JavaScript to interact with the database.