Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/07/2010, 10:18
pepeart01
 
Fecha de Ingreso: julio-2010
Mensajes: 19
Antigüedad: 13 años, 9 meses
Puntos: 1
Poner el total en formato de moneda

Hola a todos tengo el siguiente problema estoy realizando un sistema de cotizador si el checkbox seleccionado sume y si es deseleccionado reste la cantidad esta parte ya le tengo realizada pero el total lo necesito con separador de miles e intentado de varias formas pero no le doy al formato espero alguien me pueda ayudar a solucionarlo de antemano gracias por su atención. Les dejo el script.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
var total=0;

function sumar(valor) {
total += valor;
document.formulario.total.value=total;
}

function restar(valor) {
total-=valor;
document.formulario.total.value=total;
}

</script>
</head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<form name=formulario>
<input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(1000.98); else restar(1000.98)" value="checkbox">$1,000.98<br>
<input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(2000.50); else restar(2000.50)" value="checkbox">$2,000.50<br>
<input type="text" name="total" value="0">
</form>
</body>
</html>