<script language="javascript"><!-- var tax_rates = new Array(); tax_rates["1"] = 0; tax_rates["2"] = 3; tax_rates["3"] = 6; tax_rates["4"] = 7; tax_rates["5"] = 21; tax_rates["6"] = 22; function doRound(x, places) { return Math.round(x * Math.pow(10, places)) / Math.pow(10, places); } function getTaxRate() { var selected_value = document.forms["new_product"].prod_z_vat.selectedIndex; var parameterVal = document.forms["new_product"].prod_z_vat[selected_value].value; if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) { return tax_rates[parameterVal]; } else { return 0; } } function updateGross() { var taxRate = getTaxRate(); var grossValue = document.forms["new_product"].prod_z_netto.value; if (taxRate > 0) { grossValue = grossValue * ((taxRate / 100) + 1); } document.forms["new_product"].prod_z_brutto .value = doRound(grossValue, 4); } function updateNet() { var taxRate = getTaxRate(); var netValue = document.forms["new_product"].prod_z_brutto.value; if (taxRate > 0) { netValue = netValue / ((taxRate / 100) + 1); } document.forms["new_product"].prod_z_netto.value = doRound(netValue, 4); } //--></script> <form method="POST" action="--WEBBOT-SELF--" enctype="multipart/form-data"> <table border="0" cellpadding="0" cellspacing="0" width="567" height="605"> <tr> </tr> <tr> <td height="21" width="132">Nazwa Produktu: </td> <td height="21" width="435"> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td height="21" width="132" bgcolor="#EBEBFF"> <td height="21" width="435" bgcolor="#EBEBFF"> <select name="prod_z_vat" onchange="updateGross()"> </tr> <tr> <td height="21" width="132" bgcolor="#EBEBFF"> <td height="21" width="435" bgcolor="#EBEBFF"> </tr> <tr> <td height="7" width="132" bgcolor="#EBEBFF"> <td height="7" width="435" bgcolor="#EBEBFF"> </tr> <tr> <td height="21" width="132" bgcolor="#EBEBFF"> <td height="21" width="435" bgcolor="#EBEBFF"> <select size="1" name="D5"> </tr> <tr> <td height="21" width="132" bgcolor="#EBEBFF"> <td height="21" width="435" bgcolor="#EBEBFF"> </tr> <tr> <td height="24" width="132" bgcolor="#EBEBFF"> <td height="24" width="435" bgcolor="#EBEBFF"> </tr> <tr> <td height="19" width="132" bgcolor="#EBEBFF"> <td height="19" width="435" bgcolor="#EBEBFF"> </tr> <tr> </tr> <tr> <td height="9" width="567" colspan="2"> </tr> <tr> <td height="14" width="132"> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td height="19" width="435"> </tr> <tr> <td height="25" width="567" colspan="2"> updateGross(); //--></SCRIPT> </table> </form>