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

¸ßЧJavaScript ×Ö·û´®Ìæ»»º¯ÊýµÄbenchmark

°æȨÉùÃ÷
£º¿ÉÒÔÈÎÒâתÔØ£¬µ«×ªÔØʱ±ØÐë±êÃ÷Ô­×÷Õßcharlee¡¢Ô­Ê¼Á´½Óhttp://tech.idv2.com/2006/11/23/javascript-strreplace-benchmark/
ÒÔ¼°±¾ÉùÃ÷¡£
¸ÐлClearΪÎÒÃÇÌṩÁËÕâ¸öЧÂʸü¸ßµÄ×Ö·û´®Ìæ»»º¯Êý
¡£ÕâÊǾ­³£Ê¹ÓõÄHTMLÌØÊâ×Ö·ûÌæ»»º¯Êý£¬¼´½« &¡¢<¡¢>¡¢" µÈº¯ÊýÌæ»»³É &¡¢<¡¢>¡¢"¡£Í¨³£µÄ×÷·¨¶¼ÊÇÁ¬ÐøʹÓÃÊý¸ö replace º¯Êý£¬¶øClear½öʹÓÃÒ»¸ö replace ¾ÍÍê³ÉÁËÌæ»»¡£
ÎÒ¶ÔÕâÁ½¸öº¯Êý×÷ÁËbenchmark£¬·¢ÏÖк¯ÊýµÄЧÂÊԼΪԭº¯ÊýµÄ1.4±¶¡£ËäȻûÓÐÔ¤ÏëÖÐÄÇô¸ßЧÂÊ£¬µ«µ±ÒªÌæ»»µÄ×Ö·û´®¸ü¶àʱ£¬Ð§ÂÊÓ¦¸Ã»áÌá¸ß°É¡£
²âÊÔ·½·¨Îª£¬¶ÔÒ»¸ö2048×Ö½Ú³¤µÄ×Ö·û´®·Ö±ðÖ´ÐÐÁ½¸öº¯Êý100´Î£¬È¡ÆäÖ´ÐÐʱ¼ä¡£ÏÂÃæΪ10´Î²âÊԵĽá¹û¡£toTXT_1 Ϊͨ³£µÄ×÷·¨£¬toTXT_2 ΪClearµÄ·½·¨¡£
toTXT_1(ms)
toTXT_2(ms)
toTXT_1/toTXT_2
1609
1204
75%
2250
1547
69%
1672
1313
79%
1813
1250
69%
1844
1219
66%
2063
1421
69%
2031
1172
58%
1797
1360
76%
2015
1281
64%
1860
1500
81%
²âÊÔ´úÂ룺
<html>
<head>
<mce:script type="text/javascript"><!--
function toTXT_1(str){
str = str.replace(/\&/g, "& amp;");
str = str.replace(/\>/g, "& gt;");
str = str.replace(/\</g, "& lt;");
str = str.replace(/\"/g, "& quot;");
str = str.replace(/\'/g, "& #39;");
return str;
}
function toTXT_2(str){
var RexStr = /\<|\>|\"|\'|\&/g
str = str.replace(RexStr,
function(MatchStr){
switch(MatchStr){
case "<":
return "& lt;";
break;
case ">":
return "& gt;";
break;
case "\"":
return "& quot;";
break;
case "'":
return "& #39;";
break;
case "&":


Ïà¹ØÎĵµ£º

ÉîÈëÀí½âJavaScript±Õ°ü(closure)


ת×Ô£ºhttp://www.felixwoo.com/?s=%E9%97%AD%E5%8C%85
ÉîÈëÀí½âJavaScript±Õ°ü(closure)
·¢±íÓÚ: 14:48 | ·ÖÀà: ¿ª·¢¼¼Êõ | ÆÀÂÛ: 25 | ÈËÆø: 6,114 |
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ ......

ÓÃJavascriptÁ¬½ÓAccessÊý¾Ý¿âµÄ·½·¨

±¾ÎĽéÉÜjavascriptÁ¬½ÓaccessÊý¾Ý¿âµÄ·½·¨¡£Õâ¶Î´úÂëÔÚ±¾µØ¿ÉÒÔÕý³£ÔËÐУ¬ÔÚÏßÔòÐèÒª×ã¹»µÄȨÏÞ¡£ÓÉÓÚ²ÉÓÃAccessÊý¾Ý¿â£¬ËùÒÔ²¢²»Ê¹Óñê×¼µÄSQLÓ﷨ʹÓÃʱ¡£ÐèҪעÒâ¡£
Õ⼸Ìì·ÑÁËͦ´óÁ¦ÆøÔÚÍøÉϲéÕÒjavascriptÁ¬½ÓaccessÊý¾Ý¿âµÄ·½·¨£¬¾­¹ýÕûÀí×ܽᣬÖÕÓÚд³öÒ»¶ÎÄܹ»ÓÐЧִÐеĴúÂë¡£
µ«ÊÇÕâ¶Î´úÂëÔÚ±¾µØ¿ÉÒÔÕý³£ÔËÐУ ......

JavaScriptÖÐconfirm,alert,promptµÄÓ÷¨

±¾ÎļòÒª½éÉÜJavaScriptÖÐconfirm,alert,promptµÄÓ÷¨,Ï£Íû´ó¼Òѧϰ¹ý³ÌÖÐÄܵõ½Ò»Ð©Æô·¢¡£
window.confirm ²ÎÊý¾ÍÖ»ÓÐÒ»¸ö¡£ÏÔʾÌáʾ¿òµÄÐÅÏ¢¡£°´È·¶¨,·µ»Øtrue£»°´È¡Ïû·µ»Øfalse¡£
< SCRIPT> var bln = window.confirm("È·¶¨Âð?"); alert(bln) < /SCRIPT> window.alert²ÎÊý£¬Ö»ÓÐÒ»¸ö£¬ÏÔʾ ......

javascript withÓ÷¨(ת)

with
(object)
   statements
²ÎÊý
object
еÄĬÈ϶ÔÏó¡£
statements
Ò»¸ö»ò¶à¸öÓï¾ä£¬object ÊǸÃÓï¾äµÄĬÈ϶ÔÏó¡£
˵Ã÷
with
Óï¾äͨ³£ÓÃÀ´Ëõ¶ÌÌض¨ÇéÐÎϱØÐëдµÄ´úÂëÁ¿¡£ÔÚÏÂÃæµÄÀý×ÓÖУ¬Çë×¢Òâ Math µÄÖظ´Ê¹Óãº
x = Math.cos(3 * Math.PI) + Math.sin(Math.LN10)
y = Math.tan(14 * ......

ÉîÈëÀí½âJavaScriptµÄ±äÁ¿×÷ÓÃÓò

ÉîÈëÀí½âJavaScriptµÄ±äÁ¿×÷ÓÃÓò
http://www.cnblogs.com/rainman/archive/2009/04/28/1445687.html
ÔÚѧϰJavaScriptµÄ±äÁ¿×÷ÓÃÓò֮ǰ£¬ÎÒÃÇÓ¦µ±Ã÷È·¼¸µã£º
a¡¢JavaScriptµÄ±äÁ¿×÷ÓÃÓòÊÇ»ùÓÚÆäÌØÓеÄ×÷ÓÃÓòÁ´µÄ¡£
b¡¢JavaScriptûÓп鼶×÷ÓÃÓò¡£
c¡¢º¯ÊýÖÐÉùÃ÷µÄ±äÁ¿ÔÚÕû¸öº¯ÊýÖж¼Óж¨Òå¡£
1¡¢JavaScriptµÄ×÷ÓÃÓòÁ´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ