Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javascript Closures

Javascript Closures
Introduction
The Resolution of Property Names on Objects
Assignment of Values
Reading of Values
Identifier Resolution, Execution Contexts and Scope Chains
The Execution Context
Scope chains and [[scope]]
Identifier Resolution
Closures
Automatic Garbage Collection
Forming Closures
What can be done with Closures?
Example 1: setTimeout with Function References
Example 2: Associating Functions with Object Instance Methods
Example 3: Encapsulating Related Functionality
Other Examples
Accidental Closures
The Internet Explorer Memory Leak Problem
Introduction
Closure A "closure" is an expression (typically a function) that can have free variables together with an environment that binds those variables (that "closes" the expression).
Closures are one of the most powerful features of ECMAScript (javascript) but they cannot be property exploited without understanding them. They are, however, relatively easy to create, even accidentally, and their creation has potentially harmful consequences, particularly in some relatively common web browser environments. To avoid accidentally encountering the drawbacks and to take advantage of the benefits they offer it is necessary to understand their mechanism. This depends heavily on the role of scope chains in identifier resolution and so on the resolution of property names on objects.
The simple explanation of a Closure is that ECMAScript allows inner functions; function definitions and function expressions that are inside the function bodes of other functions. And that those inner functions are allowed access to all of the local variables, parameters and declared inner functions within their outer function(s). A closure is formed when one of those inner functions is made accessible outside of the function in which it was contained, so that it may be executed after the outer function has returned. At which point it still has access to the local variables, parameters and inne


Ïà¹ØÎĵµ£º

[ת]ÓÃJavascript»ñÈ¡Ò³ÃæÔªËØµÄλÖÃ

ÓÃJavascript»ñÈ¡Ò³ÃæÔªËØµÄλÖÃ
ÈîÒ»·å ·¢±íÓÚ 2009Äê09ÔÂ14ÈÕ
|
·ÖÀࣺÊ×Ò³
-> µµ°¸
-> IT¼¼Êõ


ÖÆ
×÷ÍøÒ³µÄ¹ý³ÌÖУ¬ÄãÓÐʱºòÐèÒªÖªµÀij¸öÔªËØÔÚÍøÒ³ÉϵÄÈ·ÇÐλÖá£
ÏÂÃæµÄ½Ì³Ì×ܽáÁËJavascriptÔÚÍøÒ³¶¨Î»·½ÃæµÄÏà¹ØÖªÊ¶¡£
Ò»¡¢ÍøÒ³µÄ¾ø¶Ô´ó ......

ÍÆ¼ö¼æÈÝ IE¡¢ FireFox µÄ javascript ÈÕÀú¿Ø¼þ

ÍÆ¼ö¼æÈÝ IE¡¢ FireFox µÄ javascript ÈÕÀú¿Ø¼þ
Ô­´´×÷Õߣºº®Óð·ã£¨cityhunter172£© 
Ò»¡¢¼ò½éÓëÉùÃ÷
            ´ËÈÕÀú¿Ø¼þÊÇ CSDN ÍøÓÑ KimSoft  µÄ×÷Æ·£ºhttp://blog.csdn.net/kimsoft/archive/2006/05/24/753225.aspx  ¡£½çÃæÇåˬ£¬´¿ ......

JavaScriptÈ¡µÃselect option value

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<mce:style type="text/css"><!--

div#show { float: right; color: blue; }

--></mce:style><style type="text/css" mce_bogus=" ......

ie6ÖÐhrefÉèΪjavascript:void(0)Ò³ÃæÎÞ·¨Ìá½»

<a class="bt_3" href="javascript:void(0)" mce_href="javascript:void(0)" id="btnSubmit1" onclick="submitPage()">Ìá½»</a>
submitPage() ÊÇÎÒ¶¨ÒåµÄÒ»¸öº¯Êý£¬Ô­ÒâÊǵã»÷Õâ¸ö<a>ʱ£¬Ìá½»Ò»¸ö±íµ¥¡£ft, ie6 ¾ÓÈ»²»¿ÉÒÔ£¬ÔõôҲ²»ÄÜÌá½»¡£
¿´À´ÊÇÒòΪ ie6 Ö´ÐÐĬÈ϶¯×÷ÒýÆðÀ´£¬Ä¿Ç°Á½ÖÖ½â¾ö·½·¨£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ