[·Òë]High Performance JavaScript(015)
µÚÎåÕ Strings and Regular Expressions ×Ö·û´®ºÍÕýÔò±í´ïʽ
Practically all JavaScript programs are intimately tied to strings. For example, many applications use Ajax to fetch strings from a server, convert those strings into more easily usable JavaScript objects, and then generate strings of HTML from the data. A typical program deals with numerous tasks like these that require you to merge, split, rearrange, search, iterate over, and otherwise handle strings; and as web applications become more complex, progressively more of this processing is done in the browser.
¼¸ºõËùÓÐJavaScript³ÌÐò¶¼Óë×Ö·û´®²Ù×÷½ôÃÜÏàÁ¬¡£ÀýÈ磬Ðí¶àÓ¦ÓóÌÐòʹÓÃAjax´Ó·þÎñÆ÷»ñÈ¡×Ö·û´®£¬½«ÕâЩ×Ö·û´®×ª»»³É¸üÒ×ÓõÄJavaScript¶ÔÏó£¬È»ºó´ÓÊý¾ÝÖÐÉú³ÉHTML×Ö·û´®¡£Ò»¸öµäÐ͵ijÌÐòÐèÒª´¦ÀíÈô¸ÉÕâÑùµÄÈÎÎñ£¬ºÏ²¢£¬·Ö½â£¬ÖØÐÂÅÅÁУ¬ËÑË÷£¬±éÀú£¬ÒÔ¼°ÆäËû·½·¨´¦Àí×Ö·û´®¡£Ëæ×ÅÍøÒ³Ó¦ÓÃÔ½À´Ô½¸´ÔÓ£¬Ô½À´Ô½¶àµÄ´ËÀàÈÎÎñ½«ÔÚä¯ÀÀÆ÷ÖÐÍê³É¡£
In JavaScript, regular expressions are essential for anything more than trivial string processing. A lot of this chapter is therefore dedicated to helping you understand how regular expression engines internally process your strings and teaching you how to write regular expressions that take advantage of this knowledge.
ÔÚJavaScriptÖУ¬ÕýÔò±í´ïʽÊDZز»¿ÉÉٵĶ«Î÷£¬ËüµÄÖØÒªÐÔÔ¶³¬¹ýËöËéµÄ×Ö·û´®´¦Àí¡£±¾ÕÂʹÓÃÏ൱ƪ·ù°ïÖúÄúÁ˽âÕýÔò±í´ïʽÒýÇæ´¦Àí×Ö·û´®µÄÔÀí£¬²¢½²ÊÚÈçºÎÀûÓÃÕâЩ֪ʶÊéдÕýÔò±í´ïʽ¡£
Also in this chapter, you'll learn about the fastest cross-browser methods for concatenating and trimming strings, discover how to increase regex performance by reducing backtracking, and pick up plenty of other tips and tricks for efficiently processing strings and regular expressions.
ͨ¹ý±¾ÕÂÄÚÈÝ£¬Äú»¹½«Ñ§µ½¹ØÓÚÁ¬½Ó¡¢ÐÞÕû×Ö·û´®µÄ×î¿ìµÄ¿çä¯ÀÀÆ÷·½·¨£¬Ì½Ë÷ÈçºÎͨ¹ý¼õÉÙ»ØËÝÀ´Ìá¸ßÕýÔò±í´ïʽµÄÐÔÄÜ£¬²¢ÌôÑ¡ÁËһЩ¹ØÓÚ¸ßЧ´¦Àí×Ö·û´®ºÍÕýÔò±í´ïʽµÄ¼¼ÇÉ¡£
String Concatenation ×Ö·
Ïà¹ØÎĵµ£º
C#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃ
ÎÊ£º
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
ÎÊÌâ1´ð°¸ÈçÏ£º
javaScriptº¯ÊýÖÐÖ´ÐÐC#´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ ......
ÃæÏò¶ÔÏóµÄÓïÑÔ¶àÊý¶¼Ö§³Ö¼Ì³Ð£¬¼Ì³Ð×îÖØÒªµÄÓŵã¾ÍÊÇ´úÂ븴Ó㬴Ӷø¹¹½¨´óÐÍÈí¼þϵͳ¡£Èç¹ûÒ»¸öÀàÄܹ»ÖØÓÃÁíÒ»¸öÀàµÄÊôÐԺͻò·½·¨£¬¾Í³Æ֮Ϊ¼Ì³Ð¡£
´ÓÕâ¸ö½Ç¶ÈÀ´¿´¿´jsµÄ¼Ì³Ð·½Ê½¡£jsÖм̳з½Ê½ÓëдÀ෽ʽϢϢÏà¹Ø¡£²»Í¬µÄдÀ෽ʽÔì³É²»Í¬µÄ¼Ì³Ð·½Ê½¡£¸÷ÖÖÁ÷ÐÐjs¿â¼Ì³Ð·½Ê½Ò²¸÷²»Ïàͬ¡£´Ó×î¼òµ¥µÄ
¸´ÓÿªÊ¼¡£
1¡¢¹¹Ôìº ......
£¼script language="javaScript"£¾
function closeWindow()
{
¡¡window.opener = null;
¡¡window.open(' ', '_self', ' ');
¡¡window.close();
}
£¼/script£¾
£¼input type='button' value='¹Ø±Õ´°¿Ú' onClick="closeWindow()"£¾
»ò
£¼input type="button" value="¹ ......
ÍæPHP¡¢Delphi¡¢Java»ù±¾É϶¼ÓжÔÏó£¬Ï°¹ßÕâÖÖ˼·ºóÉÏÊÖÈκÎÓïÑÔ¶¼Ïë¿¿OO˼·£¬Õâ¾ø²»ÊÇÔÚ¸Ïʱ÷Ö£¬¶øÊÇ°ÑÏà¹Ø´úÂë½øÐÐÄÚ¾ÛµÄÈ·¿ÉÒÔÌå»áµ½Î¬»¤µÄ·½±ã£¡
ÔÚJavaScriptÖÐÈçºÎ´´½¨¶ÔÏó£¿
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄ£¡ËüÒ²ÊÇÒÔObjectΪ¸ùÀ࣬ÆäËüÀà¼Ì³ÐÖ®¡£ÔÚ¸ùÀàÌṩÁ˼¸¸ö·½·¨¡£¹©¼Ì³ÐÀàʹÓã¡
ÒÔÏÂÊÇ´´½¨¶ÔÏóµÄÀý×Ó£º
funct ......
typeof ÊÇJavaScriptµÄÔËËã·û
——·µ»ØÒ»¸öÓÃÀ´±íʾ±í´ïʽµÄÊý¾ÝÀàÐ͵Ä×Ö·û´®
typeof[(] expression [)] //typeofÓï·¨ÖеÄÔ²À¨ºÅÊÇ¿ÉÑ¡Ïî
typeof ÔËËã·û@import url(../html-vss/msdnie4a.css);
typeof
ÔËËã·û°ÑÀàÐÍÐÅÏ¢µ±×÷×Ö·û´®·µ»Ø¡£typeof
·µ»ØÖµÓÐÁ ......