Bueno hay esta mi problema:
Con el
var valor = Math.round(1750000000*Math.random())+50000;
me salia un cifras a lazar 2.658.125 , 6.001.598...etc arriba de la tabla
Con el
var valor = 1000000;
sale 1.000.000 sobre la tabla
Todo arriba de la tabla y la tabla sin los puntos
Código Javascript
:
Ver original<SCRIPT>
var valor = 1000000;
var cadena = valor.toString().split("").reverse().join("");
for (var z = cadena.length; z >=0; z--) {
numero = cadena.charAt(z)
if ((cadena.length >= 4 && z ==3 ) || (cadena.length >= 7 && z ==6 ) || (cadena.length >= 10 && z == 9 ) || (cadena.length >= 13 && z ==12 ) || (cadena.length >= 16 && z ==15 )) {
numero += ".";
}
document.write(numero);
}
function dp(price)
{
string = "" + price;
number = string.length - string.indexOf('.');
if (string.indexOf('.') == -1)
return string + '.00';
if (number == 1)
return string + '00';
if (number == 2)
return string + '0';
if (number > 3)
return string.substring(0,string.length-number+3);
return string;
}
function calculate()
{
document.calcform.total1.value = dp((document.calcform.price1.value)*(document.calcform.quantity1.value))
document.calcform.total2.value = dp((document.calcform.price2.value)*(document.calcform.quantity2.value))
document.calcform.total3.value = dp((document.calcform.price3.value)*(document.calcform.quantity3.value))
document.calcform.total4.value = dp((document.calcform.price4.value)*(document.calcform.quantity4.value))
document.calcform.total5.value = dp((document.calcform.price5.value)*(document.calcform.quantity5.value))
document.calcform.total6.value = dp((document.calcform.price6.value)*(document.calcform.quantity6.value))
document.calcform.total7.value = dp((document.calcform.price7.value)*(document.calcform.quantity7.value))
document.calcform.total8.value = dp((document.calcform.price8.value)*(document.calcform.quantity8.value))
document.calcform.total9.value = dp((document.calcform.price9.value)*(document.calcform.quantity9.value))
document.calcform.total10.value = dp((document.calcform.price10.value)*(document.calcform.quantity10.value))
document.calcform.subtotal.value = dp(eval(document.calcform.total1.value) + eval(document.calcform.total2.value) + eval(document.calcform.total3.value) + eval(document.calcform.total4.value) + eval(document.calcform.total5.value) + eval(document.calcform.total6.value) + eval(document.calcform.total7.value) + eval(document.calcform.total8.value) + eval(document.calcform.total9.value) + eval(document.calcform.total10.value))
document.calcform.tax.value = dp((document.calcform.subtotal.value)*0.175)
document.calcform.total.value = dp((document.calcform.subtotal.value)*1.175)
}
</SCRIPT>
Disculpa la molestia