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

javascriptÖеÄdefer

ÔÚʹÓÃgetElementByIdʱÓÖÓöµ½ÁË“document.getElementById('...')Ϊ¿Õ»ò²»ÊÇ·½·¨”µÄ´íÎó£¬alert()ÁËһϷ¢ÏÖ»ñÈ¡µÄֵΪnull£¬ÓÚÊÇÕÒÁË°ëÌìËÑË÷µ½ÁËÕâ¸öÕâ¸ödefer¡£
ÔÚjavascript±êÇ©ÖмÓÉÏ defer µÈÓÚÔÚÒ³ÃæÍêÈ«ÔÚÈëºóÔÙÖ´ÐУ¬Ï൱ÓÚ window.onload £¬µ«Ó¦ÓÃÉϱȠwindow.onload ¸üÁé»î£¡
deferÊǽű¾³ÌÐòÇ¿´ó¹¦ÄÜÖеÄÒ»¸ö“ÎÞÃûÓ¢ÐÛ”¡£Ëü¸æËßä¯ÀÀÆ÷Script¶Î°üº¬ÁËÎÞÐèÁ¢¼´Ö´ÐеĴúÂ룬²¢ÇÒ£¬ÓëSRCÊôÐÔÁªºÏʹÓã¬Ëü»¹¿ÉÒÔʹÕâЩ½Å±¾ÔÚºǫ́±»ÏÂÔØ£¬Ç°Ì¨µÄÄÚÈÝÔòÕý³£ÏÔʾ¸øÓû§¡£
--µ«ÊÇ Îĵµ¼ÓÔØÍê±ÏÁËÔÙÖ´Ðнű¾
×îºóÇë×¢ÒâÁ½µã£º
1¡¢²»ÒªÔÚdeferÐ͵Ľű¾³ÌÐò¶ÎÖе÷ÓÃdocument.writeÃüÁÒòΪdocument.write½«²úÉúÖ±½ÓÊä³öЧ¹û¡£
2¡¢¶øÇÒ£¬²»ÒªÔÚdeferÐͽű¾³ÌÐò¶ÎÖаüÀ¨ÈκÎÁ¢¼´Ö´Ðнű¾ÒªÊ¹ÓõÄÈ«¾Ö±äÁ¿»òÕߺ¯Êý¡£ 
Ò»¸ö³£ÓõÄÓÅ»¯ÐÔÄܵķ½·¨ÊÇ£ºµ±½Å±¾²»ÐèÒªÁ¢¼´ÔËÐÐʱ£¬ÔÚ<SCRIPT>±êÇ©ÖÐÉèÖÓdefer”ÊôÐÔ¡£ (Á¢¼´½Å±¾Ã»Óб»°üº¬ÔÚÒ»¸öfunction¿éÖÐ,Òò´Ë»áÔÚ¼ÓÔعý³ÌÖÐÖ´ÐС£) ÉèÖÓdefer”ÊôÐÔºó£¬IE¾Í²»±ØµÈ´ý¸Ã½Å±¾×°ÔغÍÖ´ÐÐÍê±Ï¡£ÕâÑùÒ³Ãæ¼ÓÔØ»á¸ü¿ì¡£Ò»°ãÀ´Ëµ£¬ÕâÒ²±íÃ÷Á¢¼´½Å±¾×îºÃ·ÅÔÚfunction¿éÖУ¬²¢ÔÚdocument»òÕßbody¶ÔÏóµÄonload ¾ä±úÖд¦Àí¸Ãº¯Êý¡£ÔÚÓÐһЩ½Å±¾ÐèÒªÒÀÀµÓû§²Ù×÷¶øÖ´ÐÐʱ----ÀýÈçµã»÷°´Å¥£¬»òÕßÒƶ¯Êó±êµ½Ä³¸öÇøÓò----ʹÓøÃÊôÐԷdz£ÓÐÓᣵ«µ±ÓÐһЩ½Å±¾ÐèÒªÔÚÒ³Ãæ¼ÓÔعý³ÌÖлò¼ÓÔØÍê³ÉºóÖ´ÐУ¬Ê¹ÓÃdeferÊôÐԵõ½µÄºÃ´¦¾Í²»Ì«´ó¡£
µ«ÊÇÎñ±Ø×¢ÒâµÄÊÇdeferÔÚfirefoxÖв»ÆðÆä×÷Óã¬ËùÒÔ»¹ÊÇÒªÓÃwindow.onload()¡£


Ïà¹ØÎĵµ£º

javascript¿ØÖÆdivÐÅÏ¢¾ÓÖÐ

×ʹÓÃjquery.form.js×öÁËÒ»¸ö²éѯҳÃ棬ÔÚËÑË÷³ö½á¹ûºó£¬ÐèÒª·ÖÒ³£¬ÔÚ·ÖÒ³Öеã»÷ÏÂÒ»Ò³Ò³²ÅÓÃajaxÌá½»£¬ÔÚÌύûÓзµ»Ø½á¹ûÊÇÐèÒª¸ø¿Í»§ÏÔʾһÏÂÕýÔÚ¼ÓÔØÊý¾Ý£¬¹ÊÓÃjquery.1.3.2.js×öÁËÒ»¸öÐÅÏ¢ÌáʾµÄ½Å±¾¡£
´úÂëÈçÏ£º
<div id="loadProcess" style="z-index:1;visibility:hidden;width:300px;position:absolute;t ......

ת javascriptʵÏÖ½Ó¿Ú

Ô­ÎĵØÖ·:http://www.cnblogs.com/harrychen66/archive/2008/10/10/488457.html
 javascriptʵÏÖ½Ó¿Ú
ÏàÐźܶàÈËÖ®ËùÒÔ¶ÔjavascriptûÓкøÐ,¿ÉÄÜÊÇÒòΪËüÌ«ËæÒâÁË,ÀýÈ綨Òå±äÁ¿¿ÉÒÔËæÒâµÄ¼Óvar,»òÕß²»¼Ó,ÿÌõÓï¾äºóÃæµÄ¿ÉÒÔËæÒâµÄ¼ÓÉÏ";",»òÕß²»¼Ó,¿ÉÄÜ×îÄÑÈÌÊܵÄÊÇ,varÁËÒ»¸ö±äÁ¿ºó,Ëü¿ÉÒÔÊÇÈκÎÀàÐÍ,û ......

JavaScriptÅжÏCheckBoxListÖеÄÏîÊÇ·ñÑ¡ÖÐ

/*¼ì²éÊÇ·ñÑ¡Öи´Ñ¡¿ò2010Äê3ÔÂ6ÈÕ10:36:48*/
function checkSelect(id, msg){
var checks = $(id).getElementsByTagName("input");
var flag=false;
if(checks.length!=null){
for(var i=0;i<checks.length;i++){
if(checks[i].type=="checkbox" && checks[i].checked= ......

javascript css cookie»»Æ¤·ô

һ˵µ½javascript¾ÍÓÐÈË»áÏëµ½java£¬µ«ÊÇËûÃÇÍê»áÊÇÁ½»ØÊ£¬javascriptÊÇÃæÏò¶ÔÏóµÄ¶¯Ì¬ÀàÐ͵ÄÇø·Ö´óСдµÄ¿Í»§¶Ë½Å±¾ÓïÑÔ£¬Çë×¢Òâ´óСÓÐÇø±ð£¬ÃæÏò¶ÔÏó¡£javascriptÓÃ;ºÜ¶àµÄ£¬Ä¿Ç°¼¸ºõËùÓÐÖ÷Á÷ä¯ÀÀÆ÷¶¼Ö§³Ö¡£µ«ÊÇËûÓÐÒ»¸ö»µ´¦¾ÍÊDZäÁ¿£¬Èçvar
i=4;Õâ¸öi¾ÍÊÇintÀàÐ͵ģ¬var
s="hello",Õâ¸ösÊÇ×Ö·û´®ÀàÐ͵ģ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ