Código PHP:
echo "<td>";
echo " Largo:";
echo "</td>";
echo "<td>";
echo "<input type= \"text\" name= \"txtlargoem\" size= \"25\" maxlength= \"25\" value = \"".pg_result($bd->Consulta_ID,0,'ue_largo')."\" onBlur=\"VOLUMEN('frmmostrarmodprod','embarque')\">";
echo "</td>";
echo "<td>";
echo " Ancho:";
echo "</td>";
echo "<td>";
echo "<input type= \"text\" name= \"txtanchoem\" size= \"25\" maxlength= \"25\" value = \"".pg_result($bd->Consulta_ID,0,'ue_ancho')."\" onBlur=\"VOLUMEN('frmmostrarmodprod','embarque')\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo " Alto:";
echo "</td>";
echo "<td>";
echo "<input type= \"text\" name= \"txtaltoem\" size= \"25\" maxlength= \"25\" value = \"".pg_result($bd->Consulta_ID,0,'ue_alto')."\" onBlur=\"VOLUMEN('frmmostrarmodprod','embarque')\">";
echo "</td>";
echo "<td>";
echo " Volumen:";
echo "</td>";
echo "<td>";
echo "<input type= \"text\" name= \"txtvolumenem\" size= \"25\" maxlength= \"25\" value = \"".pg_result($bd->Consulta_ID,0,'ue_volumen')."\">";
echo "</td>";
echo "</tr>";
y el codigo de la funcion en javascript es el siguiente:
function VOLUMEN(form,opc)
{
frm=document.forms[form];
if(opc =='embarque')
{
if(isNaN(parseFloat(frm.txtlargoem.value)))
largo=0;
else
largo= parseFloat(frm.txtlargoem.value);
if(isNaN(parseFloat(frm.txtanchoem.value)))
ancho=0;
else
ancho= parseFloat(frm.txtanchoem.value);
if(isNaN(parseFloat(frm.txtaltoem.value)))
alto=0;
else
alto= parseFloat(frm.txtaltoem.value);
frm.txtvolumenem.value = largo*ancho*alto;
}
else if(opc =='manejo')
{
if(isNaN(parseFloat(frm.txtlargomj.value)))
largo=0;
else
largo= parseFloat(frm.txtlargomj.value);
if(isNaN(parseFloat(frm.txtanchomj.value)))
ancho=0;
else
ancho= parseFloat(frm.txtanchomj.value);
if(isNaN(parseFloat(frm.txtaltomj.value)))
alto=0;
else
alto= parseFloat(frm.txtaltomj.value);
frm.txtvolumenmj.value=largo*ancho*alto;
}
if(frm.slundcompmj.disabled == true)
{
frm.txtlargomj.value = frm.txtlargoem.value;
frm.txtanchomj.value = frm.txtanchoem.value;
frm.txtaltomj.value = frm.txtaltoem.value;
frm.txtvolumenmj.value = frm.txtvolumenem.value;
}
}
por favor ayuda gracias.