javascriptËÄÉáÎåÈëµÄÎÊÌâ
Çó 555.555µÄËÄÉáÎåÈë±£ÁôÁ½Î»Ð¡Êý
ʹÓÃMath.round Ôõô¶¼Ëã²»¶Ô,½á¹û¶¼ÊÇ555.55 ,Ã²ËÆÊÇÒòΪjava¼ÆË㸡µãÊýʱ»áĪÃûÆäÃîÔÚ½áβ¸úÉÏÒ»´®Êý×Ö ±ÈÈç555.55500000003
ÎÞÄÎÖ»ÄÜдÕâ¸ö·½·¨
function round(a,b){
var s=a.toString().indexOf(".");
a0=a.toString().substr(0,s+b+1);
a1=Math.round(a.toString().substr(s+b+1,1)*0.1)*Math.pow(10,-b);
return(a0*1+a1);
}
function fix(v,n){
var s =''+v;
var flag=false;
if(s.substring(0,1)=='0'){
s='1'+s;
flag=true;
alert(1);
}
var i =(s).indexOf('.');
if (s.length-i-1>n){
s=s.substring(0,s.length-(s.length-i-2-n));
var j =''+ Math.floor((s.replace('.','')/10+0.5));
j=j.substring(0,i)+'.'+j.substring(i,j.length);
if(flag){
return j.substring(1,j.length);
}else{
return j;
}
}else{
return s;
}
}
»ù±¾ÉÏ¿ÉÒÔÓÃ=.=
Ïà¹ØÎĵµ£º
ÔÎÄ£º¡¶Speeding up JavaScript: Working with the DOM¡·
×÷Õߣº KeeKim Heng, Google Web Developer
ÔÚÎÒÃÇ¿ª·¢»¥ÁªÍø¸»Ó¦Óã¨RIA£©Ê±£¬ÎÒÃǾ³£Ð´Ò»Ð©javascript½Å±¾À´Ð޸ĻòÕßÔö¼ÓÒ³ÃæÔªËØ£¬ÕâЩ¹¤×÷×îÖÕÊÇDOM——»òÕß˵Îĵµ¶ÔÏóÄ£ÐÍ——À´Íê³ÉµÄ£¬¶øÎÒÃǵÄʵÏÖ·½Ê½»áÓ°Ïìµ½Ó¦ÓõÄÏìÓ¦ËÙ¶È¡£
DO ......
10¸öÓÅÐãµÄAjaxºÍJavascript¹úÍâ×ÊÔ´ÍøÕ¾
×ªÔØµØÖ·£ºhttp://www.zzsky.cn/build/content/1246.htm
1¡¢Ajax Rain: http://www.ajaxrain.com
¡¡¡¡AjaxRainÓкܶàÍêÃÀÕûºÏAjax¡¢CSS¡¢DHTML»òJavascriptµÄʵÀý£¬ÓÐһЩDemoµÄÈ·ÖµµÃÄãÈ¥¿´Ò»¿´£¬¼´Ê¹Äã²»ÊÇÍøÒ³Éè¼Æ£¨¿ª·¢£©Ê¦¡ ......
¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç
Ò»¡¢ ǰÑÔ
http://blog.csdn.net/soldierluo/archive/2010/02/25/5326520.aspx
¶þ¡¢ »Ø¹é¼òµ¥¡¢»ù±¾ÀàÐÍ
http://blog.csdn.net/soldierluo/archive/2010/02 ......