易截截图软件、单文件、免安装、纯绿色、仅160KB

[翻译]High Performance JavaScript(007)

Dynamic Scopes  动态作用域
    Both the with statement and the catch clause of a try-catch statement, as well as a function containing eval_r(), are all considered to be dynamic scopes. A dynamic scope is one that exists only through execution of code and therefore cannot be determined simply by static analysis (looking at the code structure). For example:
    无论是with表达式还是try-catch表达式的catch子句,以及包含eval_r()的函数,都被认为是动态作用域。一个动态作用域只因代码运行而存在,因此无法通过静态分析(察看代码结构)来确定(是否存在动态作用域)。例如:
function execute(code) {
  eval_r(code);
  function subroutine(){
    return window;
  }
  var w = subroutine();
  //what value is w?
};
    The execute() function represents a dynamic scope due to the use of eval_r(). The value of w can change based on the value of code. In most cases, w will be equal to the global window object, but consider the following:
    execute()函数看上去像一个动态作用域,因为它使用了eval_r()。w变量的值与code有关。大多数情况下,w将等价于全局的window对象,但是请考虑如下情况:
execute("var window = {};")
    In this case, eval_r() creates a local window variable in execute(), so w ends up equal to the local window instead of the global. There is no way to know if this is the case until the code is executed, which means the value of the window identifier cannot be predetermined.
    这种情况下,eval_r()在execute()函数中创建了一个局部window变量。所以w将等价于这个局部window变量而不是全局的那个。所以说,不运行这段代码是没有办法了解具体情况的,标识符window的确切含义不能预先确定。
    Optimizing JavaScript engines such as Safari's Nitro try to speed up identifier resolution by analyzing the code to determine which variables should be accessible at any given time. These engines try to avoid the traditional scope chain lookup by inde


相关文档:

javascript stuffs

Primitive types
1. undefined, null, boolean, number, string; undefined is derived from null.
e.g. var tmp; typeof tmp == undefined.
e.g. void(javascript:aler(‘x’)) == undefined.
e.g. undefined==null
2. NaN!=NaN isNaN(“123”)==false isNaN(“blue”)==true ......

javascript的history.go( 1)

javascript的history.go(-1)
echo '<script language="javascript">{alert("留言不能为空!");history.go(-1);}</script>';}
echo '<script language="javascript">{alert("留言不能为空!");return true;}</script>';}
这是不刷新页面的方式 ......

firefox与IE对javascript和CSS的区别

1. document.formName.item("itemName") 问题
说明:IE下,可以使用document.formName.item("itemName")或document.formName.elements["elementName"];
Firefox下,只能使用document.formName.elements["elementName"].
解决方法:统一使用document.formName.elements["elementName"].
2.集合类对象问题
说明:IE下,可 ......

JavaScript的BASE64

**
* 我在网上看到过很多BASE64的JavaScript算法,都觉得不满意,于是自己写了一个,在这里分享一下。
* 我的代码在质量的效率都较高,没有一些冗余的操作。总体来讲我觉得非常不错。
* 如果大家有什么不懂的地方可以问我。
*/
var BASE64={
    /**
     * 此变量为编码的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号