Показать сообщение отдельно
Старый 11.02.2007, 17:52
vic_ вне форума Посмотреть профиль Отправить личное сообщение для vic_ Посетить домашнюю страницу vic_ Найти все сообщения от vic_
  № 2  
Ответить с цитированием
vic_
 
Аватар для vic_

Регистрация: Sep 2006
Адрес: Zaporozhye, Ukraine
Сообщений: 141
Код:
Number.prototype.toFixed = function(  fractionDigits ){
var x, m, r, str, d, i;
x = this;
if( isNaN( x ) )return "NaN";

if( (fractionDigits == null) || (fractionDigits < 0) ){
fractionDigits = 0;
}
else if( fractionDigits > 20 ){
fractionDigits = 20;
}
m   = Math.pow( 10, fractionDigits );
r   = Math.round( x*m ) / m;
str = r.toString();
d   = str.split( "." )[1];
if( d && (d.length < fractionDigits) ){
for( i=0; i<(fractionDigits-d.length); i++ ){
str += "0";
}
}
return str;
}
выдрал отсюда
http://code.google.com/p/core2/
файл core2_AS2/lib/core2/core2_v1.0.1_AS.as1
не проверял