Ahi envio el codigo, pero me gustaria que me indicaran bien de como enviar los codigos para que se vean agradables, ya que como lo veo aqui no se ve bien.
<html>
<head>
<SCRIPT>
function NumberFormat(num,numDec,decSep,thousandSep) {
var arg;
var Dec;
Dec = Math.pow(10,numDec);
if(typeof(num) == 'undefined') return;
if(typeof(decSep) == 'undefined') decSep = ',';
if(typeof(thousandSep) == 'undefined') thousandSep = '.';
if(thousandSep == '.'){
arg=/\./g;
}else if(thousandSep == ','){
arg=/\,/g;
}
if(typeof(arg) != 'undefined'){
num = num.toString().replace(arg,'');
}
num = num.toString().replace(/,/g,'.');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*Dec+0.50000000001);
cents = num%Dec;
num = Math.floor(num/Dec).toString();
if(cents<(Dec/10))
{
cents = "0" + cents;
}
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+thousandSep+ num.substring(num.length-(4*i+3));
if(Dec==1)
return (((sign)?'':'-') + num);
else
return (((sign)?'':'-') + num + decSep + cents);
}
function EvaluateText(cadena,obj) {
opc=false;
if(cadena=="%d")
{
if((event.keyCode > 47 && event.keyCode < 58))
{
opc=true
}
}
if(cadena=="%f")
{
if((event.keyCode > 47 && event.keyCode < 58))
{
opc=true
}
if(obj.value.search("[.*]")==-1 && obj.value.length!=0)
{
if(event.keyCode==46)
opc=true;
}
}
if(opc==false)
event.returnValue = false;
}
</script>
</head>
<body>
numero
<input type=text name=input1 size=15 value="500034567" onkeypress="EvaluateText('%f',this);"
onBlur="this.value=NumberFormat(this.value,'2','.' ,',');"><br><br>
</form>
</body>
</html>