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

[·­Òë]High Performance JavaScript(028)

JavaScript Minification  JavaScript½ô´Õ
    JavaScript minification is the process by which a JavaScript file is stripped of everything that does not contribute to its execution. This includes comments and unnecessary whitespace. The process typically reduces the file size by half, resulting in faster downloads, and encourages programmers to write better, more extensive inline documentation.
    JavaScript½ô´ÕÖ¸µÄÊÇÌÞ³ýÒ»¸öJavaScriptÎļþÖÐÒ»ÇÐÔËÐÐÎÞ¹ØÄÚÈݵĹý³Ì¡£°üÀ¨×¢ÊͺͲ»±ØÒªµÄ¿Õ¸ñ¡£¸Ã´¦Àíͨ³£¿É½«Îļþ³ß´çËõ¼õµ½Ò»°ë£¬Æä½á¹ûÊÇÏÂÔØËٶȸü¿ì£¬²¢¹ÄÀø³ÌÐòԱд³ö¸üºÃ£¬¸üÏêϸµÄÄÚÁªÎĵµ¡£
    JSMin (http://www.crockford.com/javascript/jsmin.html), developed by Douglas Crockford, remained the standard in JavaScript minification for a long time. However, as web applications kept growing in size and complexity, many felt it was time to push JavaScript minification a step further. This is the main reason behind the development of the YUI Compressor (http://developer.yahoo.com/yui/compressor/), a tool that performs all kinds of smart operations in order to offer a higher level of compaction than other tools in a completely safe way. In addition to stripping comments and unnecessary whitespace, the YUI Compressor offers the following features:
    JSMin£¨http://www.crockford.com/javascript/jsmin.html£©£¬ÓÉDouglas Crockford¿ª·¢£¬Ëü±£³ÖÁËJavaScript½ô´Õ±ê×¼ºÜ³¤Ò»¶Îʱ¼ä¡£È»¶øËæ×ÅÍøÂçÓ¦ÓóÌÐòÔÚ¹æÄ£ºÍ¸´ÔÓÐÔÉϲ»¶ÏÔö³¤£¬Ðí¶àÈËÈÏΪJavaScript½ô´ÕÓ¦µ±ÔÙÏòÇ°ÍÆ½øÒ»²½¡£ÕâÊÇ¿ª·¢YUIѹËõÆ÷µÄÖ÷ÒªÔ­Òò£¨http://developer.yahoo.com/yui/compressor/£©ËüÌṩÁËËùÓÐÀàÐ͵ÄÖÇÄܲÙ×÷£¬ÎªÁËÌṩ±ÈÆäËü¹¤¾ß¸ü¸ß¼¶µÄ½ô´Õ²Ù×÷²¢ÇÒÒÔÍêÈ«°²È«µÄ·½·¨ÊµÏÖ¡£³ýÁËÌÞ³ý×¢ÊͺͲ»±ØÒªµÄ¿Õ¸ñ£¬YUIѹËõÆ÷»¹ÌṩÒÔϹ¦ÄÜ£º
• Replacement of local variable names with shorter (one-, two-, or three-character) variable names, picked to optimize gzip compression downstream
  ½«¾Ö²¿±äÁ¿ÃûÌæ»»ÒÔ¸ü¶ÌµÄÐÎʽ£¨1¸ö£¬2¸ö£¬»ò3¸ö×Ö·û£©£¬ÒÔÓÅ»¯ºóÐøµÄgzipѹËõ¹¤×÷
• Rep


Ïà¹ØÎĵµ£º

javascriptЧÂʾ­Ñé̸(Ò»)

±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔ­À´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾­Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾­¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷Ô­Òò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......

ͨ¹ýjavascript»ñµÃurl²ÎÊý

Ò³ÃæÌá½»Êý¾ÝÒ»°ãÓÐÁ½ÖÖ·½·¨£ºget,post¡£post¾ÍÊÇËùνµÄformÌá½»£¬Ê¹ÓÃÊÓͼ£»getÊÇͨ¹ýurlÌá½»¡£
Get·½·¨Ò»°ãÓúǫ́´úÂ루Èçasp,asp.net£©»ñµÃ²ÎÊý£¬´úÂëºÜ¼òµ¥£ºRequest.QueryString["id"];¼´¿É»ñÈ¡¡£ 
ÓÐЩʱºòÐèÒªÖ±½ÓÔÚǰ̨»ñÈ¡url²ÎÊý£¬ÒªÓõ½javascript£¬jsûÓÐÖ±½Ó»ñÈ¡url²ÎÊýµÄ·½·¨£¬ÄÇô£¬ÎÒÃÇÈçºÎͨ¹ýjs ......

JavaScript»ù´¡ÖªÊ¶3

Òþ²Ø³ÉÔ±±äÁ¿
ÔÚº¯ÊýÌåÄÚ¶¨ÒåµÄ±äÁ¿Îª¾Ö²¿±äÁ¿£¬À뿪º¯Êý¾Í¹ÒµôÁË
ÔÚº¯ÊýÌåÄÚʹÓÃthis.³ÉÔ±±äÁ¿Ãû£¬ÔòΪwindow¶ÔÏó¼¶±äÁ¿£¬¼´È«¾Ö±äÁ¿
¹ÊÐèÒªÕâÑùÒþ²Ø³ÉÔ±±äÁ¿£¬ÏòÍâÖ»±©Â¶get¡¢setº¯Êý
function testClass(name){
var _firstname=name;
return {
getname : function() {
return _fir ......

[·­Òë]High Performance JavaScript(024)

Data Format Conclusions  Êý¾Ý¸ñʽ×ܽá
    Favor lightweight formats in general; the best are JSON and a character-delimited custom format. If the data set is large and parse time becomes an issue, use one of these two techniques:
    ×ܵÄÀ´ËµÔ½ÇáÁ¿¼¶µÄ¸ñʽԽºÃ£¬× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ