Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/01/2005, 01:10
Avatar de TomaHawkk
TomaHawkk
 
Fecha de Ingreso: diciembre-2001
Ubicación: España
Mensajes: 422
Antigüedad: 22 años, 4 meses
Puntos: 1
Sonrisa

Hola,

me daba un pequeño fallo y cambiando una cosilla del último código funciona correctamente:

Código:
function Decimales(Numero, Decimales) {

	pot = Math.pow(10,Decimales);
	num = parseInt(Numero * pot) / pot;
	nume = num.toString().split('.');

	entero = nume[0];
	decima = nume[1];

	if (decima != undefined) {
		fin = Decimales-decima.length; }
	else {
		decima = '';
		fin = Decimales; }

	for(i=0;i<fin;i++)
	  decima+=String.fromCharCode(48); 

	num=entero+'.'+decima;
	return num;
}
Un saludo y gracias
__________________
ThE MaTriX HaS YoU