Un ejemplo simple de calculo de IVA:
Código Javascript
:
Ver original<html>
<head>
<script language="JavaScript">
function calcular()
{
var precio= parseFloat( document.getElementById("precio_no_tax").value);
var tax = parseFloat( document.getElementById("tax").value);
var total = document.getElementById("total").value = precio*tax*0.01 + precio;
}
</script>
</head>
<body onload="calcular();">
<form method="POST" action="tu_script.php" name="form">
<tbody>
<tr>
<td>Id producto:</td>
<td><input type="text" name="id_product" value="22" readonly size="3"></td>
</tr>
<tr>
<td>Precio(sin iva):</td>
<td><input type="text" id="precio_no_tax" name="price_notax" value="100" size="5" onkeyup="calcular();"></td>
</tr>
<tr>
<td>Iva:</td>
<td>
<select name="tax" id="tax" onchange="calcular();">
<option value="0" selected>Ninguna</option>
<option value="16">16</option>
<option value="30">30</option>
</select>
</td>
</tr>
<tr>
<td>Total:</td>
<td><input type="text" name="total" value="" id="total" size="3"></td>
</tr>
</body>
</html>