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

Javascript¼òÒ×¼ÆÊ±Æ÷£¨ÓÃÀ´¼ÇËã´úÂëµÄÖ´ÐÐʱ¼ä£©

×Ô¼ºÐ´µÄÒ»¸ö¼òÒ×¼ÆÊ±Æ÷£¬ÄܼÇËã´úÂëµÄÖ´ÐÐʱ¼ä£¬»¹¿ÉÒÔÄÃÀ´²âÊÔ´úÂëµÄÖ´ÐÐЧÂÊ¡£
function Counter(){
this.start();
}
Counter.prototype.getTime = function(){
var time = new Date();
return time.getSeconds()*1000+time.getMilliseconds();
}
Counter.prototype.start = function(){
this.counting = true;
this.startTime = this.getTime();
}
Counter.prototype.stop = function(){
if(this.counting == true){
this.counting = false;
this.stopTime = this.getTime();
}
}
Counter.prototype.show = function(){
this.counting==true && this.stop();
this.time = this.stopTime-this.startTime;
document.write('Ö´ÐдúÂ뻨·ÑÁË '+this.time+' ºÁÃë<br>');
this.start();
}
ʹÓÃʾÀýÈçÏ£º
var myCounter = new Counter();
for(var i=0;i<500;i++){
document.write('|');
}
myCounter.show();
var myCounter2 = new Counter();
document.write('<br>');
myCounter2.start(); //ÖØÐ¿ªÊ¼¼ÆÊ±
for(var i=0;i<500;i++){
document.write('*');
}
myCounter2.stop(); //Í£Ö¹¼ÆÊ±
for(var i=0;i<500;i++){
document.write(';');
}
myCounter2.show(); //ÕâÀïÏÔʾµÄʱ¼äÊÇÖ´ÐеÚÒ»´ÎforÑ­»·ËùÓõÄʱ¼ä(¾ÍÊÇÊä³öÒ»ÅÅ*µÄÄǸö)
ÔÚ´´½¨¶ÔÏóºó»á×Ô¶¯¿ªÊ¼¼ÆÊ±¡£
µ÷ÓöÔÏóµÄstart()·½·¨½«ÖØÐ¿ªÊ¼¼ÆÊ±¡£
µ÷ÓÃstop()·½·¨»áÍ£Ö¹¼ÆÊ±¡£
show()·½·¨ÓÃÀ´ÏÔʾ´úÂëÖ´ÐеÄʱ¼ä£¨Èç¹ûµ÷ÓÃshow()·½·¨Ç°Ã»Óе÷Óùýstop()£¬»á×Ô¶¯µ÷ÓÃÒ»´Î£©
¶à¸ö¼ÆÊ±¶ÔÏóÖ®¼ä»¥²»Ó°Ïì¡£
ÒòΪÎÒ»¹ÊǸö²ËÄñ£¬Ï£Íû´ó¼Ò¶ÔÎҵIJ»×ãÖ®´¦µãÆÀÖ¸Õý£¡


Ïà¹ØÎĵµ£º

javascript ¿Í»§¶Ë Éú³É MD5Öµ

×î½ü̫æ,ûÓÐʱ¼ä×ܽṤ×÷ÄÚÈÝÁË,æÀï͵ÏаÉ,¹²ÏíÏÂÎÒµÄJavaScript MD5 ½Å±¾
 var hex_chr = "0123456789abcdef";
function rhex(num)
{
str = "";
for(j = 0; j <= 3; j++)
str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +
hex_chr.charAt((num >> (j * 8)) & 0x0F);
re ......

ÓÃjavascriptʵÏÖÒ³ÃæÎÞˢиüÐÂÊý¾Ý

³ÌÐòÉè¼ÆÖлᾭ³£Åöµ½Ò»ÖÖÇé¿ö£¬¾ÍÊÇÊÂÏÈÎÞ·¨µÃÖªÓû§»áÐèÒªÄÄЩÊý¾Ý£¬±ØÐë¸ù¾ÝÓû§Ñ¡ÔñºóÔÙ´Ó·þÎñÆ÷
ÖØÐÂÌáÈ¡Êý¾Ýºó·´À¡¸øÓû§¡£±ÈÈçÒ»¼òµ¥µÄÇé¿ö£¬Óû§Ñ¡ÔñÊ¡·ÝÒÔºó£¬ÎÒÃÇÁ¢¼´»áÔÚÊÐÀï±ß½«Õâ¸öÊ¡µÄËùÓÐ
ÊÐÖØÐÂÏÔʾ³öÀ´¡£ÕâÖÖÇé¿öÒ»°ãÐèÒª½«Õû¸öÒ³ÃæË¢Ðºó²Å¿ÉÒÔÖØÐ¶ÁÈ¡£¬µ«ÕâÑù²»½öЧÂʲ»¸ßÍ⣬ҲÏԵò»
Ì«ÓÅÑÅ¡£Æäʵ ......

javascriptÖеÄevalº¯ÊýµÄÓ÷¨(תÌù)

±¾ÎĵÄÁ½¸öÄ¿µÄ£º
£¨1£©½éÉÜjavascriptÖеÄevalº¯ÊýµÄÓ÷¨
£¨2£©ÈçºÎÔÚº¯ÊýÄÚÖ´ÐÐÈ«¾Ö´úÂë
►ÏÈÀ´ËµevalµÄÓ÷¨£¬ÄÚÈݱȽϼòµ¥£¬ÊìϤµÄ¿ÉÒÔÌø¹ý¡£
evalº¯Êý½ÓÊÕÒ»¸ö²ÎÊýs£¬Èç¹ûs²»ÊÇ×Ö·û´®£¬ÔòÖ±½Ó·µ»Øs¡£·ñÔòÖ´ÐÐsÓï¾ä¡£Èç¹ûsÓï¾äÖ´Ðнá¹ûÊÇÒ»¸öÖµ£¬Ôò·µ»Ø´ËÖµ£¬·ñÔò·µ»Øundefined¡£
ÐèÒªÌØ±ð×¢ÒâµÄÊǶÔÏóÉùÃ÷Óï· ......

javascript: ÕýÔò±í´ïʽ

ÕýÔò±í´ïʽ
RegExp(regexp, option)ÀàʵÏÖ,¿ÉÒÔ¼òд³É/regexp/option
option:
g: global, i: ignore case
·½·¨:string.test(regexp),
string.exec(regexp)[·µ»ØËùÓÐÆ¥ÅäµÄµØ·½], string.serch(regexp)[ÕýÔò°æµÄindexOf()],
string.replace(regexp, str|funtion), string.split(regexp)
¼òµ¥Ä£Ê½
Ôª×Ö·û:( [ {
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ