 
			
				04/01/2011, 14:34
			
			
			     |  
      |    |    |    Fecha de Ingreso: octubre-2003  Ubicación: Hermosillo, Sonora  
						Mensajes: 75
					  Antigüedad: 22 años Puntos: 0     |        |  
  |      Respuesta: Formato numerico de un text con miles y decimales        Despues de tantos años hice ajustes, espero te sirva esta función   
onkeyup=formatoMoneda(this.value, false)   
// simbolo: true->regresar el simbolo 
function formatoMoneda(obj, simbolo) 
    { 
    punto = ""; 
    num += ""; 
    posicion = num.indexOf('.'); 
    cents = ""; 
    if(posicion != -1)  
        { 
        punto = "."; 
        cents = num.substring(posicion); 
        if(cents.length >= 4) cents = cents.substring(0, 3); 
        posicion += posicion / 3; 
        num = num.split('.')[0] + cents; 
        }   
    num = num.toString().replace(/\$|\,/g,''); 
    if(isNaN(num)) num = "0"; 
    sign = (num == (num = Math.abs(num))); 
    num = Math.floor(num*100+0.50000000001); 
    num = Math.floor(num/100).toString(); 
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
        num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));   
    if(simbolo) simbolo = '$' 
    else simbolo = '' 
    return (((sign)?'':'-') + simbolo + num + ((cents != "00" && cents.length > 0) ? cents : '')); 
    }           |