function CalculateUnit(longitud) { var sourceValue = longitud.valor.value; sourceValue = parseFloat(sourceValue); if ( !isNaN(sourceValue) || sourceValue == 0) { longitud.valor.value = sourceValue; ConvertFromTo(longitud); } else { alert("Lo ingresado no puede convertirse o es cero!"); } } function ConvertFromTo(longitud){ var result; result = longitud.valor.value; result = result * longitud.select1.value; result = result / longitud.select2.value; longitud.valor2.value = result; } function CalculateUnit2(volumen) { var sourceValue = volumen.valorv.value; sourceValue = parseFloat(sourceValue); if ( !isNaN(sourceValue) || sourceValue == 0) { volumen.valorv.value = sourceValue; ConvertFromTo2(volumen); } else { alert("Lo ingresado no puede convertirse o es cero!"); } } function ConvertFromTo2(volumen){ var propIndex; var sourceIndex = 1; var sourceFactor = 1; var targetIndex = 1 ; var targetFactor = 1; var result; propIndex = "volumen"; // sourceIndex = sourceForm.unit_menu.selectedIndex; //sourceFactor = factor[propIndex][sourceIndex]; // targetIndex = targetForm.unit_menu.selectedIndex; // targetFactor = factor[propIndex][targetIndex]; result = volumen.valorv.value; result = result * volumen.selectv1.value; result = result / volumen.selectv2.value; volumen.valorv2.value = result; } function CalculateUnit3(peso) { var sourceValue = peso.valorp.value; sourceValue = parseFloat(sourceValue); if ( !isNaN(sourceValue) || sourceValue == 0) { peso.valorp.value = sourceValue; ConvertFromTo3(peso); } else { alert("Lo ingresado no puede convertirse o es cero!"); } } function ConvertFromTo3(peso){ var propIndex; var sourceIndex = 1; var sourceFactor = 1; var targetIndex = 1 ; var targetFactor = 1; var result; propIndex = "peso"; // sourceIndex = sourceForm.unit_menu.selectedIndex; //sourceFactor = factor[propIndex][sourceIndex]; // targetIndex = targetForm.unit_menu.selectedIndex; // targetFactor = factor[propIndex][targetIndex]; result = peso.valorp.value; result = result * peso.selectp1.value; result = result / peso.selectp2.value; peso.valorp2.value = result; }