Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ЧÂʾ­Ñé̸(Ò»)

±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔ­À´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾­Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾­¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷Ô­Òò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......

JavaScriptʵÏÖÒ³Ãæ´«Öµ

ÎÒ»¹ÊDzËÄñ£¬Çë´ó¼Ò¶àÖ¸½Ì£¡
Ò³ÃæÒ»£º
<html>
 <head>
  <title> Ò³Ãæ´«ÖµÒ» </title>
  <script>
    function funShow()
 {
    var arr=new Array(6);
       var arrs = showModalDialog("Ò³ ......

javascriptÈëÃÅ»ù´¡ÖªÊ¶

javascriptÈëÃÅ»ù´¡ÖªÊ¶
ÎÄÕÂÔ´ÓÚ²©¿Í£ºhttp://www.cnblogs.com/seesky/articles/1433526.html
ÔÚÍøÕ¾ÖÆ×÷µÄ¹ý³ÌÖо­³£ÐèÒªÓõ½JavaScriptÓï¾ä£¬ÕÆÎÕһЩÏà¹ØµÄJavaScript½á¹¹¶ÔÍøÕ¾ÖÆ×÷ÓÐ×ÅÖØµÄÖØÓã¡
1.document.write(""); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
......

phpÖеÄevalºÍJavaScriptÖеÄeval

phpÖеÄevalºÍJavaScriptÖеÄevalÇø±ð£º
Definition and Usage

¶¨ÒåºÍÓ÷¨
The eval() function evaluates a
string as PHP code.
eval()º¯ÊýµÄ×÷ÓÃÊÇ£º·µ»ØÓëPHP´úÂëÏà¶ÔÓ¦µÄ×Ö·û´®¡£
The string
must be valid PHP code and must end with semicolon.
Õâ¸ö×Ö·û´®±ØÐëÊÇÓÐЧµÄPHP´úÂ룬
²¢ÇÒ±ØÐëÒԷֺŽáÊø¡ ......

JavaScriptµÄBASE64

**
* ÎÒÔÚÍøÉÏ¿´µ½¹ýºÜ¶àBASE64µÄJavaScriptËã·¨£¬¶¼¾õµÃ²»ÂúÒ⣬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£¬ÔÚÕâÀï·ÖÏíһϡ£
* ÎҵĴúÂëÔÚÖÊÁ¿µÄЧÂʶ¼½Ï¸ß£¬Ã»ÓÐһЩÈßÓàµÄ²Ù×÷¡£×ÜÌåÀ´½²ÎÒ¾õµÃ·Ç³£²»´í¡£
* Èç¹û´ó¼ÒÓÐʲô²»¶®µÄµØ·½¿ÉÒÔÎÊÎÒ¡£
*/
var BASE64={
    /**
     * ´Ë±äÁ¿Îª±àÂëµÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ