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

²»ÌÆÍ»µÄJavaScriptµÄÆßÌõ×¼Ôò

 Ó¢ÎÄÔ­ÎÄ£ºThe seven rules of Unobtrusive JavaScript
Ô­ÎÄ×÷ÕߣºChris Heilmann
¾­¹ý¶àÄêµÄ¿ª·¢¡¢½ÌѧºÍ±àд²»ÌÆÍ»µÄJavaScript£¬ ÎÒ·¢ÏÖÁËÏÂÃæµÄһЩ׼Ôò¡£ÎÒÏ£ÍûËüÃÇ¿ÉÒÔ°ïÖúÄã¶Ô“ΪʲôÕâÑùÉè¼ÆºÍÖ´ÐÐJavaScript±È½ÏºÃ”ÓÐÒ»µãÀí½â¡£ÕâЩ¹æÔòÔø¾­°ïÖúÎÒ¸ü¿ìµØ½»¸¶²úÆ·£¬²¢ÇÒ²úÆ·µÄÖÊÁ¿¸ü¸ß£¬Ò²¸üÈÝÒ×ά»¤¡£
1.²»Òª×öÈκμÙÉè
£¨JavaScriptÊÇÒ»¸ö²»¿É¿¿µÄÖúÊÖ£©
¿ÉÄܲ»ÌÆÍ»µÄJavaScript µÄ×îÖØÒªµÄÒ»¸öÌØÐÔ¾ÍÊÇ——ÄãҪֹͣÈκμÙÉ裺
    * ²»Òª¼ÙÉèJavaScriptÊÇ¿ÉÓõģ¬Äã×îºÃÈÏΪËüºÜÓпÉÄÜÊDz»¿ÉÓõģ¬¶ø²»ÊÇÖ±½ÓÒÀÀµÓÚËü¡£
    * ÔÚÄã¾­¹ý²âÊÔÈ·ÈÏһЩ·½·¨ºÍÊôÐÔ¿ÉÒÔʹÓÃ֮ǰ£¬²»Òª¼ÙÉèä¯ÀÀÆ÷Ö§³ÖËüÃÇ¡£
    * ²»Òª¼ÙÉèHTML´úÂëÈçÄãÏëÏóµÄÄÇÑùÕýÈ·£¬Ã¿´Î¶¼Òª½øÐмì²é£¬²¢ÇÒµ±Æä²»¿ÉÓõÄʱºò¾ÍʲôҲ²»Òª×ö¡£
    * ÈÃJavaScriptµÄ¹¦ÄܶÀÁ¢ÓÚÊäÈëÉ豸
    * Òª¼ÇסÆäËûµÄ½Å±¾¿ÉÄÜ»áÓ°ÏìÄãµÄJavaScriptµÄ¹¦ÄÜ£¬ËùÒÔÒª±£Ö¤ÄãµÄ½Å±¾µÄ×÷ÓÃÓò¾¡¿ÉÄܵذ²È«¡£
ÔÚ¿ªÊ¼Éè¼ÆÄãµÄ½Å±¾Ö®Ç°£¬Òª¿¼ÂǵĵÚÒ»¼þÊÂÇé¾ÍÊǼì²éÒ»ÏÂÄãҪΪÆä±àд½Å±¾µÄHTML´úÂ룬¿´¿´ÓÐʲô¶«Î÷¿ÉÒÔ°ïÖúÄã´ïµ½Ä¿µÄ¡£
2.ÕÒ³ö¹³×Ӻͽڵã¹Øϵ
£¨HTMLÊǽű¾µÄ»ùʯ£©
ÔÚ¿ªÊ¼±àд½Å±¾Ö®Ç°£¬ÒªÏÈ¿´Ò»ÏÂÄãҪΪ֮±àдJavaScriptµÄHTML¡£Èç¹ûHTMLÊÇδ¾­×éÖ¯µÄ»òÕßδ֪µÄ£¬ÄÇôÄ㼸ºõ²»¿ÉÄÜÓÐÒ»¸öºÃµÄ
½Å±¾±àд·½°¸——ºÜ¿ÉÄܾͻá³öÏÖÏÂÃæµÄÇé¿ö£ºÒªÃ´ÊÇ»áÓÃJavaScript´´½¨Ì«¶à±ê¼Ç£¬ÒªÃ´¾ÍÊÇÓ¦ÓÃÌ«ÒÀÀµÓÚJavaScript¡£
ÔÚHTMLÖÐÓÐһЩ¶«Î÷ÐèÒª¿¼ÂÇ£¬ÄǾÍÊǹ³×Ӻͽڵã¹Øϵ¡£
<1>.HTML ¹³×Ó
HTML×î³õµÄºÍ×îÖØÒªµÄ¹³×Ó¾ÍÊÇID£¬¶øÇÒID¿ÉÒÔͨ¹ý×î¿ìµÄDOM·½·¨——getElementById
·ÃÎʵ½¡£Èç¹ûÔÚÒ»¸öÓÐЧµÄHTMLÎĵµÖÐËùÓеÄID¶¼ÊǶÀÒ»ÎÞ¶þµÄ»°£¨ÔÚIEÖйØÓÚname ºÍ ID
ÓÐÒ»¸öbug£¬²»¹ýÓÐЩºÃµÄÀà¿â½â¾öÁËÕâ¸öÎÊÌ⣩£¬Ê¹ÓÃID¾ÍÊÇ°²È«¿É¿¿µÄ£¬²¢ÇÒÒ×ÓÚ²âÊÔ¡£
ÆäËûһЩ¹³×Ó¾ÍÊÇÊÇHTMLÔªËغÍCSSÀ࣬HTMLÔªËØ¿ÉÒÔͨ¹ýgetElementsByTagName·½·¨·ÃÎÊ£¬¶øÔÚ¶àÊýä¯ÀÀÆ÷Öж¼»¹²»ÄÜ
ͨ¹ýÔ­ÉúµÄDOM·½·¨À´·ÃÎÊCSSÀà¡£²»¹ý£¬ÓкܶàÍⲿÀà¿âÌṩÁË¿ÉÒÔ·ÃÎÊCSSÀàÃû£¨ÀàËÆÓÚ getElementsByClassName£©
µÄ·½·¨¡£
<2>.HTML ½Úµã¹Øϵ
¹ØÓÚHTMLµÄÁíÍâ±È½ÏÓÐÒâ˼µÄÒ»µã¾ÍÊDZê¼ÇÖ®¼äµÄ¹Øϵ£¬Ë¼¿¼ÏÂÃæµÄÎÊÌ⣺
    * ÒªÔõÑù²Å¿ÉÒÔ×îÈÝÒ×µØ


Ïà¹ØÎĵµ£º

JavaScriptÃæÏò¶ÔÏó³ÌÐòÉè¼Æ(6): ·â×°

 ±¾²©¿ÍתÔØÓÚ£ºhttp://devbean.javaeye.com/blog/407517
·â×°ÊÇÃæÏò¶ÔÏóµÄÖØÒª¸ÅÄîÖ®Ò»¡£Èç¹ûÒ»¸ö³ÌÐòûÓзâ×°ÐÔ£¬Ò²¾Í̸²»ÉÏʲôÃæÏò¶ÔÏó¡£µ«ÊÇ£¬JavaScript²¢²»ÏñÆäËûµÄÓïÑÔ£¬±ÈÈçJava£¬Óй«ÓбäÁ¿ºÍ˽ÓбäÁ¿µÈ£»ÔÚJavaScriptÖÐÖ»ÓÐÒ»ÖÖ×÷ÓÃÓò£º¹«ÓÐ×÷ÓÃÓò¡£ÔÚ±¾ÕÂÖУ¬ÎÒÃǽ«»á¼ûʶµ½JavaScriptÊÇÈçºÎʵÏÖ·â×°µÄÌØ ......

JavaScript ÁãÉ¢±Ê¼Ç

JavaScript ÁãÉ¢±Ê¼Ç
1 ´´½¨½Å±¾¿é
1: <script language=”JavaScript”>
2: JavaScript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”JavaScript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </script>
ÔÚ²»Ö ......

JavaScriptµ÷ÓÃC++º¯Êý

 ÉÏƪ½éÉÜÁËÓÃC++µ÷ÓÃJavaScript£¬Õâƪ·´¹ýÀ´ËµËµJSµ÷C++£¬ÕâÑùJSºÍC++¹µÍ¨µÄ;¾¶¾ÍÍêÕûÁË¡£
Ê×ÏÈ£¬ÊµÏÖÒ»¸öIDispatch½Ó¿Ú£¬µ±JSµ÷ÓÃC++º¯Êýʱ£¬ÏµÍ³»áµ÷ÓÃGetIDsOfNamesÀ´Óú¯ÊýÃûÈ¡µÃº¯ÊýµÄDISPID£¬È»ºóµ÷ÓÃInvokeÍê³ÉÕæÕýµÄµ÷Óã¬ÐèҪעÒâµÄÊÇInvokeµÄpDispParamsÖеIJÎÊýÊǵ¹ÐòµÄ¡£´úÂëÈçÏ£º
class CExtenalDis ......

Top 10 JavaScript Frameworks by Google

 À´×Ô£ºhttp://www.tripwiremagazine.com/tools/developer-toolbox/top-10-javascript-frameworks-by-google.html
Wed, Nov 11, 2009
Development
, Javascript
, Tools




JavaScript – an indispensable part for developing websites and web
pages, whether th ......

JavaScriptÓï·¨¼¯½õ


click()    ¶ÔÏó.click()    ʹ¶ÔÏó±»µã»÷¡£
closed    ¶ÔÏó.closed    ¶ÔÏó´°¿ÚÊÇ·ñÒѹرÕtrue/false
clearTimeout(¶ÔÏó) Çå³ýÒÑÉèÖõÄsetTimeout¶ÔÏó
clearInterval(¶ÔÏó) Çå³ýÒÑÉèÖõÄsetInterval¶ÔÏó
confirm("ÌáʾÐÅÏ¢") µ¯³öÈ·ÈÏ¿ò£¬È· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ