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

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

µÚËÄÕ  Algorithms and Flow Control  Ëã·¨ºÍÁ÷³Ì¿ØÖÆ
    The overall structure of your code is one of the main determinants as to how fast it will execute. Having a very small amount of code doesn't necessarily mean that it will run quickly, and having a large amount of code doesn't necessarily mean that it will run slowly. A lot of the performance impact is directly related to how the code has been organized and how you're attempting to solve a given problem.
    ´úÂëÕûÌå½á¹¹ÊÇÖ´ÐÐËٶȵľö¶¨ÒòËØÖ®Ò»¡£´úÂëÁ¿ÉÙ²»Ò»¶¨ÔËÐÐËٶȿ죬´úÂëÁ¿¶àÒ²²»Ò»¶¨ÔËÐÐËÙ¶ÈÂý¡£ÐÔÄÜËðʧÓë´úÂë×éÖ¯·½Ê½ºÍ¾ßÌåÎÊÌâ½â¾ö°ì·¨Ö±½ÓÏà¹Ø¡£
    The techniques in this chapter aren't necessarily unique to JavaScript and are often taught as performance optimizations for other languages. There are some deviations from advice given for other languages, though, as there are many more JavaScript engines to deal with and their quirks need to be considered, but all of the techniques are based on prevailing computer science knowledge.
    ±¾Õ¼¼Êõ²»½öÊÊÓÃÓÚJavaScriptÒ²ÊÊÓÃÓÚÆäËûÓïÑÔµÄÐÔÄÜÓÅ»¯¡£»¹ÓÐһЩΪÆäËûÓïÑÔÌṩµÄ½¨Ò飬»¹Òª´¦Àí¶àÖÖJavaScriptÒýÇæ²¢¿¼ÂÇËüÃǵIJîÒ죬µ«ÕâЩ¼¼Êõ¶¼ÒÔµ±Ç°¼ÆËã»ú¿Æѧ֪ʶΪ»ù´¡¡£
Loops  Ñ­»·
    In most programming languages, the majority of code execution time is spent within loops. Looping over a series of values is one of the most frequently used patterns in programming and as such is also one of the areas where efforts to improve performance must be focused. Understanding the performance impact of loops in JavaScript is especially important, as infinite or long-running loops severely impact the overall user experience.
    ÔÚ´ó¶àÊý±à³ÌÓïÑÔÖУ¬´úÂëÖ´ÐÐʱ¼ä¶àÊýÔÚÑ­»·Öжȹý¡£ÔÚһϵÁбà³ÌģʽÖУ¬Ñ­»·ÊÇ×î³£ÓõÄģʽ֮һ£¬Òò´ËÒ²ÊÇÌá¸ßÐÔÄܱØÐë¹Ø×¢µÄµØÇøÖ®Ò»¡£Àí½âJavaScriptÖÐÑ­»·¶ÔÐÔÄܵÄÓ°ÏìÖÁ¹ØÖØÒª£¬ÒòΪËÀÑ­»·»òÕß³¤Ê±¼äÔËÐеÄÑ­»·»áÑÏÖØÓ°ÏìÓû§ÌåÑé¡£
Types of Loops  Ñ­»·µÄÀàÐ


Ïà¹ØÎĵµ£º

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

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

ASP.NETÖÐǰ̨javascriptÓëºǫ́´úÂëµ÷ÓÃ

C#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃ
ÎÊ£º
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
ÎÊÌâ1´ð°¸ÈçÏ£º
javaScriptº¯ÊýÖÐÖ´ÐÐC#´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ ......

javascript cookies ´æ¡¢È¡¡¢É¾³ýʵÀý

<script>
//дcookiesº¯Êý ×÷ÕߣºµÔÕñ¿­
function
SetCookie(name,value)//Á½¸ö²ÎÊý£¬Ò»¸öÊÇcookieµÄÃû×Ó£¬Ò»¸öÊÇÖµ
{
    var Days = 30;
//´Ë cookie ½«±»±£´æ 30 Ìì
    var exp  = new Date();    //new
Date("December 31, 9998");
    ......

JavaScript»ù´¡ÖªÊ¶1

JavascriptÊý¾ÝÀàÐÍ
ÓÉÓÚjavascriptÊÇÈõÀàÐÍÓïÑÔ£¬¼´¶¨Òå±äÁ¿Ê±²»±ØÉùÃ÷ÆäÀàÐÍ
¡£µ«Õâ²¢²»Òâζ×űäÁ¿Ã»ÓÐÀàÐÍ¡£ÒòΪ¸³ÖµÊ±»á×Ô¶¯Æ¥ÅäÊý¾ÝÀàÐÍ£¡
Ä¿Ç°Óõ½µÄ»ù±¾Êý¾ÝÀàÐÍ
number
boolean
string
var i
i="test";//Õâʱi¾Í³ÉÁËstringÀàÐÍ
var i
i=4;//Õâʱi¾Í³ÉÁËnumberÀàÐÍ
³£ÓöÔÏóÀàÐÍ<object> ......

AJAX (Òì²½ JavaScript ºÍ XML)

AJAX (Òì²½ JavaScript ºÍ XML) ÊǸöвúÉúµÄÊõÓï,רΪÃèÊöJavaScriptµÄÁ½ÏîÇ¿´óÐÔÄÜ.ÕâÁ½ÏîÐÔ
ÄÜÔÚ¶àÄêÀ´Ò»Ö±±»ÍøÂ翪·¢ÕßËùºöÂÔ,Ö±µ½×î½üGmail, Google suggestºÍgoogle MapsµÄºá¿Õ³öÊÀ²ÅʹÈË
ÃÇ¿ªÊ¼Òâʶµ½ÆäÖØÒªÐÔ.
ÕâÁ½Ïî±»ºöÊÓµÄÐÔÄÜÊÇ:
* ÎÞÐèÖØÐÂ×°ÔØÕû¸öÒ³Ãæ±ãÄÜÏò·þÎñÆ÷·¢ËÍÇëÇó.
* ¶ÔXMLÎĵµµÄ½âÎöºÍ´¦Àí£® ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ