作者TKirby ( ^-^)
看板Web_Design
标题Re: [问题] 执行javascript
时间Tue Apr 26 17:41:11 2005
RHINO : JavaScript for Java - http://www.mozilla.org/rhino/
Rhino is an open-source implementation of JavaScript written entirely in
Java. It is typically embedded into Java applications to provide scripting
to end users.
-----------------------------
SpiderMonkey : JavaScript for C - http://www.mozilla.org/js/spidermonkey/
-----------------------------
PHPJS : the PHP/JavaScript interpreter - http://phpjs.berlios.de/
This scripting language interpreter is implemented in PHP and allows to
execute user-supplied JavaScript-lookalike code server-side, without
compromising security because everything runs safely in a sandbox.
-----------------------------
FESI : a Free EcmaScript Interpreter - http://www.lugrin.ch/fesi/index.html
FESI (pronounced like fuzzy) is a full implementation of the first version
of the EcmaScript language.
(seems that it is written in Java)
-----------------------------
Windows Script - http://msdn.microsoft.com/scripting/
Windows Script is a comprehensive scripting infrastructure for the Microsoft
Windows platform. Windows Script provides two script engines, Visual Basic
Scripting Edition and Microsoft JScript®, which can be embedded into Windows
Applications. It also provides an extensive array of supporting technologies
that makes it easier for script users to script Windows applications.
-----------------------------
NOMBAS : JavaScript Anywhere - http://www.nombas.com/us/
-----------------------------
NJS : NJS JavaScript Interpreter - http://www.njs-javascript.org/
NJS is an independent implementation of the JavaScript language developed
by Netscape and standardized by ECMA. It is designed to be re-entrant,
extendible, fast, and programmable.
-----------------------------
其中有一些似乎不是 interpreter,但类似
我用过 NJS,容易编也蛮容易用的
我自己写的 javascript wiki parser 几乎没有改过就可以直接跑了
Windows 似乎可以做这种事:
test.wsf :
<job>
<script language="JScript">
var x=1;
WScript.Echo(x);
</script>
</job>
然後可以在 command line 直接执行。详情请自己看 windows scripting里的document.
(
http://msdn.microsoft.com/scripting/ )
RHINO 跟 FESI 都是 Java-based 的
RHINO 跟 SpiderMonkey 是用来作 script embedding 的
PHPJS 的网页上就有范例了,等於用 js 当 server-side script 的语言
NOMBAS 应该也是用来做 script embedding 的
没有时间一个一个都玩过,不过我想都大同小异
我觉得对你最快的方法大概是用 WSH 的方法
写个包含你要执行的 script 的 test.wsf,
然後用滑鼠左键点他两下或是在 cmd.exe 打 cscript test.wsf 执行他
不过他吃的是 VBScript 跟"JScript" 不是 javascript,别搞混啦
要注意一旦 javascript 离开了浏览器,
window、 document 等 DOM 物件会全部失效(因为既没有 window 也没有 HTML dom)
所以要玩这些东西第一件事就是找出这些程式支援什麽样的物件
比方说 NJS 支援 System.stdout.writeln
WSH 则用 WScript.StdOut.WriteLine
请翻弄各大直译器的使用手册
如果你要 IE 以外的程式来跑包含 HTML 的 javascript
但是这些程式又不是浏览器的话,那你需要追加一套 HTML parser
※ 引述《qlight (瓦解)》之铭言:
: 请问除了IE之外 有没有别的agent or 应用程式
: 可以用来跑 javascript
: 急需呀 thanks!!!
--
╭════┬════┬════┬════┬════┬═─╭═╮╮
║
████ █▋◢█│
████ ███◣│
███◣ █▋╯
◢║│
║
◤██◥│
███◤╰╮
██ │
█◣ █ █◣ ◤│
█▋◢█║│
╰╮
██╭╯
███◣╭╯
██ ███◥│
█◤ ◣│
◥██◤╰╮
│║
██║│
█▋◥█│
████│
█◥█◣ ████╰╮
██ ●║
╰╰══┴┴════┴════┴════┴════┴╰════╯
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.30.52
※ 编辑: TKirby 来自: 140.112.30.52 (04/26 17:59)