当前位置: 代码迷 >> JavaScript >> 跟大家分享一个 javascript shell
  详细解决方案

跟大家分享一个 javascript shell

热度:909   发布时间:2012-11-23 22:54:33.0
和大家分享一个 javascript shell


Javascript Shell 地址:http://www.squarefree.com/shell/

?

Features

  • You can enter statements and expressions at the same prompt.
  • The result of each non-void statement or expression is shown.
  • User-defined variables.
    • b = document.body
  • User-defined functions.
    • function f() { return 5; }
  • JavaScript error messages are shown in red.
  • Previous statements and expressions are available through Up and Down arrow keys.
  • Tab completion.
  • Multiline input (Shift+Enter to insert a line break).
  • If the shell is opened using a bookmarklet, JavaScript typed into the shell runs in the context of the original window.
  • Works well in Firefox, mostly works in Opera 8 and in IE 6 for Windows.

Built-in functions

  • ans : the result of the previous expression.
  • print(expr) : prints expr on its own line.
    • for(i = 0; i < 6; ++i) print( i * i)
  • pr(expr) : prints and returns its input, so you can use it to print intermediate results in the middle of an expression.
    • function fact(n) { return n>0 ? pr( n*fact(n-1)) : 1 }
  • blink(node) or Alt+B : makes a node blink for a second.
    • blink( document.links[3])
  • props(obj) or Alt+P : lists the methods and fields of an object.
    • props( document.body)
    • In Firefox, props also shows which properties belong to the object itself and which belong to objects in its prototype chain.
1 楼 拜月小刀 2010-04-13  
试用了下 很不错
2 楼 CodingMouse 2010-04-13  
刚刚测试了下,感觉效果真的不错!

我在想,这样一个东西,是否可以集成到一个系统中用于提供一个开发者调试页面呢?
3 楼 edisonlz 2010-04-13  
要是调试的话,firebug 下面有个console 功能和这个类似
4 楼 aleelock 2010-04-13  
不错的东东。
不过关于调试,我建议使用我写的调试工具,很好用。
http://zxoproxy.appspot.com/inject/
可以在任意页面注入代码,不会让你失望的。
5 楼 unique.wu 2010-04-14  
能不能简单介绍下,这东西怎么用的
  相关解决方案