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

Javascript ±Õ°ü


·­Ò룺Ϊ֮Âþ±Ê
Á´½Ó£ºhttp://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
¼ò½é
»ùÓÚ¶ÔÏóµÄÊôÐÔÃû½âÎö
ÖµµÄÖ¸¶¨
ÖµµÄ¶ÁÈ¡
±êʶ·û½âÎö¡¢Ö´Ðл·¾³ºÍ×÷ÓÃÓòÁ´
Ö´Ðл·¾³
×÷ÓÃÓòÁ´Óë [[scope]]
±êʶ·û½âÎö
±Õ°ü
×Ô¶¯À¬»øÊÕ¼¯
¹¹³É±Õ°ü
ͨ¹ý±Õ°ü¿ÉÒÔ×öʲô£¿
Àý 1£ºÎªº¯ÊýÒýÓÃÉèÖÃÑÓʱ
Àý 2£ºÍ¨¹ý¶ÔÏóʵÀý·½·¨¹ØÁªº¯Êý
Àý 3£º°ü×°Ïà¹ØµÄ¹¦ÄÜ
ÆäËûÀý×Ó
ÒâÍâµÄ±Õ°ü
Internet Explorer µÄÄÚÔÚй©ÎÊÌâ
¼ò½é
Closure Ëùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨ÁËÕâЩ±äÁ¿µÄ»·¾³µÄ±í´ïʽ£¨Í¨³£ÊÇÒ»¸öº¯Êý£©£¬Òò¶øÕâЩ±äÁ¿Ò²ÊǸñí´ïʽµÄÒ»²¿·Ö¡£
±Õ°üÊÇ ECMAScript £¨JavaScript£©×îÇ¿´óµÄÌØÐÔÖ®Ò»£¬µ«ÓúñհüµÄÇ°ÌáÊDZØÐëÀí½â±Õ°ü¡£±Õ°üµÄ´´½¨Ïà¶ÔÈÝÒ×£¬ÈËÃÇÉõÖÁ»áÔÚ²»¾­Òâ¼ä´´½¨±Õ°ü£¬µ«ÕâЩÎÞÒâ´´½¨µÄ±Õ°üÈ´´æÔÚDZÔÚµÄΣº¦£¬ÓÈÆäÊÇÔڱȽϳ£¼ûµÄä¯ÀÀÆ÷»·¾³Ï¡£Èç¹ûÏëÒªÑﳤ±Ü¶ÌµØʹÓñհüÕâÒ»ÌØÐÔ£¬Ôò±ØÐëÁ˽âËüÃǵŤ×÷»úÖÆ¡£¶ø±Õ°ü¹¤×÷»úÖƵÄʵÏֺܴó³Ì¶ÈÉÏÓÐÀµÓÚ±êʶ·û£¨»òÕß˵¶ÔÏóÊôÐÔ£©½âÎö¹ý³ÌÖÐ×÷ÓÃÓòµÄ½ÇÉ«¡£
¹ØÓÚ±Õ°ü£¬×î¼òµ¥µÄÃèÊö¾ÍÊÇ ECMAScript ÔÊÐíʹÓÃÄÚ²¿º¯Êý£­£­¼´º¯Êý¶¨ÒåºÍº¯Êý±í´ïʽλÓÚÁíÒ»¸öº¯ÊýµÄº¯ÊýÌåÄÚ¡£¶øÇÒ£¬ÕâЩÄÚ²¿º¯Êý¿ÉÒÔ·ÃÎÊËüÃÇËùÔÚµÄÍⲿº¯ÊýÖÐÉùÃ÷µÄËùÓоֲ¿±äÁ¿¡¢²ÎÊýºÍÉùÃ÷µÄÆäËûÄÚ²¿º¯Êý¡£µ±ÆäÖÐÒ»¸öÕâÑùµÄÄÚ²¿º¯ÊýÔÚ°üº¬ËüÃǵÄÍⲿº¯ÊýÖ®Íâ±»µ÷ÓÃʱ£¬¾Í»áÐγɱհü¡£Ò²¾ÍÊÇ˵£¬ÄÚ²¿º¯Êý»áÔÚÍⲿº¯Êý·µ»Øºó±»Ö´ÐС£¶øµ±Õâ¸öÄÚ²¿º¯ÊýÖ´ÐÐʱ£¬ËüÈÔÈ»±ØÐè·ÃÎÊÆäÍⲿº¯ÊýµÄ¾Ö²¿±äÁ¿¡¢²ÎÊýÒÔ¼°ÆäËûÄÚ²¿º¯Êý¡£ÕâЩ¾Ö²¿±äÁ¿¡¢²ÎÊýºÍº¯ÊýÉùÃ÷£¨×î³õʱ£©µÄÖµÊÇÍⲿº¯Êý·µ»ØʱµÄÖµ£¬µ«Ò²»áÊܵ½ÄÚ²¿º¯ÊýµÄÓ°Ïì¡£
Òź¶µÄÊÇ£¬ÒªÊʵ±µØÀí½â±Õ°ü¾Í±ØÐëÀí½â±Õ°ü±³ºóÔËÐеĻúÖÆ£¬ÒÔ¼°Ðí¶àÏà¹ØµÄ¼¼Êõϸ½Ú¡£ËäÈ»±¾ÎĵÄÇ°°ë²¿·Ö²¢Ã»ÓÐÉæ¼° ECMA 262 ¹æ·¶Ö¸¶¨µÄijЩËã·¨£¬µ«ÈÔÈ»ÓÐÐí¶àÎÞ·¨»Ø±Ü»ò¼ò»¯µÄÄÚÈÝ¡£¶ÔÓÚ¸ö±ðÊìϤ¶ÔÏóÊôÐÔÃû½âÎöµÄÈËÀ´Ëµ£¬¿ÉÒÔÌø¹ýÏà¹ØµÄÄÚÈÝ£¬µ«Êdzý·ÇÄã¶Ô±Õ°üÒ²·Ç³£ÊìϤ£¬·ñÔò×îºÃÊDz»ÒªÌø¹ýÏÂÃ漸½Ú¡£
¶ÔÏóÊôÐÔÃû½âÎö
ECMAScript ÈÏ¿ÉÁ½Àà¶ÔÏó£ºÔ­Éú£¨Native£©¶ÔÏóºÍËÞÖ÷£¨Host£©¶ÔÏó£¬ÆäÖÐËÞÖ÷¶ÔÏó°üº¬Ò»¸ö±»³ÆΪÄÚÖöÔÏóµÄÔ­Éú¶ÔÏóµÄ×ÓÀࣨECMA 262 3rd Ed Section 4.3£©¡£Ô­Éú¶ÔÏóÊôÓÚÓïÑÔ£¬¶øËÞÖ÷¶ÔÏóÓÉ»·¾³Ìṩ£¬±ÈÈç˵¿ÉÄÜÊÇÎĵµ¶ÔÏó¡¢DOM µÈÀàËƵĶÔÏó¡£
Ô­Éú¶ÔÏó¾ßÓÐËÉÉ¢ºÍ¶¯Ì¬µÄÃüÃûÊôÐÔ£¨¶ÔÓÚijЩʵÏÖµÄÄÚÖ


Ïà¹ØÎĵµ£º

[javascript]¶àÐÐTextBox»Ø³µ»»ÐУ¬¹â±êÒƵ½×îĩβ

Ò³ÃæÆÁ±ÎÁ˻سµ£¬½á¹û¶àÐÐÊäÈëµÄTextbox±¯¾çÁË£¬Ö»ÄÜÓÃjsÖØд»Ø³µÊ¼þ£¬±¸·ÝÒ»ÏÂ
pageloadÀï
 txt_eng.Attributes.Add("onkeypress", "enter(this)");
js£º
function enter(obj) {
            if (event.keyCode == 13) {
    &nb ......

ÈçºÎÓÃJavaScript´òÓ¡WebÒ³Ãæ

ÊÂʵÉÏIEÒѾ­ÎªÎÒÃÇÄÚǶÁËWebBrowser¿Ø¼þ£¬ÒѾ­Äܹ»ºÜºÃµÄÖ§³ÖÎÒÃdz£ÓõĴòÓ¡¹¦ÄÜÁË¡£Í¨¹ý¸Ã¿Ø¼þµÄ¹¦Äܵ÷Óã¬Óû§¿ÉÒÔ½«µ±Ç°µÄHtmlÒ³ÃæÊä³öµ½´òÓ¡»úÉÏ£¬Óû§Ö»ÐèÒª½«Òª´òÓ¡µÄÊý¾Ý×éÖ¯³ÉHtmlÒ³Ã棬Ȼºóµ÷ÓÃWebBrowserµÄ´òÓ¡¹¦ÄܾͿÉÒԺܺõÄʵÏÖËù¼û¼´ËùµÃµÄ´òÓ¡¹¦ÄÜ¡£²»¹ýÕâÖÖ´òÓ¡´æÔÚµÄȱµã¾ÍÊÇ´òÓ¡¾«¶È²»¹»£¬Èç¹ûÐèÒª¾«È· ......

JavascriptÖеÄArrayµÄRemove

JavascriptÖеÄArray¶ÔÏóûÓÐRemove·½·¨£¬ÔÚÍøÉÏÕÒµ½ÁËÒ»º¯Êý
function
 RemoveArray(array,attachId
)
{
    
for
(
var
 i
=
0
,n
=
0
;i
<
array.length;i
++
)
    
{
        
if
(array[i] ......

TEXTAREA ×Ö½ÚÏÞÖÆ(javascript£¬struts µÄÒ³Ãæ±êÇ©)

//Textarea maxlength
//flag:text¿òÃû×Ö£¬num:ÏÞÖƵÄ×Ö½ÚÊý
  function maxLen(flag,num){
  if(document.getElementById('lastMessage').value=="0" || document.getElementById('lastMessage').value==flag){
    var i=document.getElementById(flag).value.replace(/[\u0 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ