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

Àí½â JavaScript ±Õ°ü{תÔØ}

¡¾×ª¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/02/1638010.html
±¾ÎÄתÔØ×Ô£ºhttp://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
Òª³ÉΪ¸ß¼¶ JavaScript ³ÌÐòÔ±£¬¾Í±ØÐëÀí½â±Õ°ü¡£
±¾ÎĽáºÏ ECMA 262 ¹æ·¶Ïê½âÁ˱հüµÄÄÚ²¿¹¤×÷»úÖÆ£¬Èà JavaScript ±à³ÌÈËÔ±¶Ô±Õ°üµÄÀí½â´Ó“ǶÌ׵ĺ¯Êý”ÉîÈëµ½“±êʶ·û½âÎö¡¢Ö´Ðл·¾³ºÍ×÷ÓÃÓòÁ´”µÈµÈ JavaScript ¶ÔÏ󱳺óµÄÔËÐлúÖƵ±ÖУ¬ÕæÕýÁì»áµ½±Õ°üµÄʵÖÊ¡£
Ô­ÎÄÁ´½Ó£ºJavaScript Closures
¿É´òÓ¡°æ£ºJavaScript ±Õ°ü
Ŀ¼
¼ò½é
¶ÔÏóÊôÐÔÃû½âÎö
ÖµµÄ¸³Óè
ÖµµÄ¶ÁÈ¡
±êʶ·û½âÎö¡¢Ö´Ðл·¾³ºÍ×÷ÓÃÓòÁ´
Ö´Ðл·¾³
×÷ÓÃÓòÁ´Óë [[scope]]
±êʶ·û½âÎö
±Õ°ü
×Ô¶¯À¬»øÊÕ¼¯
¹¹³É±Õ°ü
ͨ¹ý±Õ°ü¿ÉÒÔ×öʲô£¿
Àý 1£ºÎªº¯ÊýÒýÓÃÉèÖÃÑÓʱ
Àý 2£ºÍ¨¹ý¶ÔÏóʵÀý·½·¨¹ØÁªº¯Êý
Àý 3£º°ü×°Ïà¹ØµÄ¹¦ÄÜ
ÆäËûÀý×Ó
ÒâÍâµÄ±Õ°ü
Internet Explorer µÄÄÚ´æй©ÎÊÌâ
¼ò½é
·µ»ØĿ¼
Closure Ëùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨ÁËÕâЩ±äÁ¿µÄ»·¾³µÄ±í´ïʽ£¨Í¨³£ÊÇÒ»¸öº¯Êý£©£¬Òò¶øÕâЩ±äÁ¿Ò²ÊǸñí´ïʽµÄÒ»²¿·Ö¡£


Ïà¹ØÎĵµ£º

JavaScript »ñÈ¡¶ÔÏóµÄ¸ß¶ÈºÍ¿í¶ÈÏêϸ˵Ã÷

scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......

Javascript¶¯Ì¬Éú³É±í¸ñµÄÐÔÄܵ÷ÓÅ


¿Í»§¶Ë¶¯Ì¬Êä³ötableÊý¾Ý²¢Õ¹Ê¾±í¸ñ£¬ÊÇwebÓ¦ÓÃÖнÏΪ³£¼ûµÄ¹¤×÷¡£¶ÔÓÚÑ­»·´òÓ¡Êä³ötr£¬td±¾ÉíÊÇÒ»¼þ·Ç³£½©Ó²ºÍ±©Á¦µÄ±à³Ì°ì·¨£¬ÔÙ¼ÓÉÏ×îºó°ó¶¨ÔªËØinnerHTML×Ö·ûÁ÷Êä³ö£¬
¡¡¡¡ÏµÍ³ËùÏûºÄµÄÐÔÄÜ´ú¼ÛÊǷdz£¸ß°ºµÄ£¬Èç¹ûÎÒÃÇÐèÒªÕ¹ÏÖµÄÊý¾Ý·Ç³£ÅÓ´óʱ£¬ÄÇô´ú¼ÛÒ²Êdzɱ¶µÄ¡£È»¶øÕâÖÖ¶¯Ì¬Êä³ö±í¸ñµÄ·½·¨ÊÇ´ó¶àÊý¿Í»§¶Ë³ÌÐòÔ ......

JavaScriptÅжϸ÷ÖÖä¯ÀÀÆ÷

function getOs(){  
var OsObject = "";  
if(navigator.userAgent.indexOf("MSIE")>0) {  
   return "MSIE";  
}  
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){  
  &n ......

ÀûÓÃJAVASCRIPTÈÃIFRAME¿ò¼ÜµÄ¸ß¶È×ÔÊÊÓ¦

Ò³ÃæÄÚǶ²»Í¬µÄÍøÒ³ÄÚÈÝʱ£¬µ¼ÖÂiframeµÄ¸ß¶ÈÎÞ·¨ÓëʵÏÖÄÚÈÝ»òä¯ÀÀÆ÷¸ß¶ÈÏàÆ¥Åä¡£´°¿Ú´óС±ä»»Ê±£¬²»ÄÜiframe²»ÄܽøÐÐ×Ô¶¯µ÷Õû¡£ÕâÀÎÒÃÇÀûÓÃJAVASCRIPTÈÃIFRAME¿ò¼ÜµÄ¸ß¶È×ÔÊÊÓ¦¡£
Ê×ÏÈ£¬Ð´³öÈçϵÄJS·½·¨¡£
/**
* ÄÚǶҳÃæµÄ¸ß¶ÈÉèÖÃ
*/
function handleFrameLoad() {
var hDoc = getBodyHeight(document);
var ......

javascriptÖÐsubstr,substring,slice.spliceµÄÇø±ð

substr() ·½·¨¿ÉÔÚ×Ö·û´®ÖгéÈ¡´Ó start ϱ꿪ʼµÄÖ¸¶¨ÊýÄ¿µÄ×Ö·û.
stringObject.substr(start,length);start±ØÐë,length¿ÉÑ¡.
start ÊǽØÈ¡µÄ¿ªÊ¼Î»ÖõÄϱê,´Ó0¿ªÊ¼ËãÆð,±ØÐëÊÇÊý×Ö.¿ÉÒÔÊǸºÊý,-1Êǵ¹ÊýµÚÒ»¸ö×Ö·û,-2Êǵ¹ÊýµÚ¶þ¸ö×Ö·û,ÒÔ´ËÀàÍÆ.
length ÊÇÒª½ØÈ¡µÄ×Ö·ûµÄ³¤¶È,±ØÐëÊÇÊý×Ö.Èç¹ûδָ¶¨,Ôò´ÓstartλÖô¦¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ