Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/01/2013, 11:30
marce_vampira
 
Fecha de Ingreso: junio-2012
Ubicación: En Chile :D
Mensajes: 44
Antigüedad: 11 años, 11 meses
Puntos: 0
habilitar boton solo con resultado requerido

Hola chicos, necesito una ayudita...

tengo el siguiente formulario de ingreso, el cual es para ingresar facturas.

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<script>
function viva() {
var n1 = parseInt(document.form.neto.value);
var n2 = parseInt(document.form.iva.value);
var n3 = parseInt(document.form.imp_esp.value);
var n4 = parseInt(document.form.total.value);
document.form.viva1.value=Math.round(((n1*0.19)-n2));
document.form.vtt.value=Math.round(n1+n2+n3-n4);
}

function deshabilita(form)
{
if ((form.vtt.value == "0"))
{ form.INGRESA.disabled = false; }

else {
form.INGRESA.disabled = true; }
}
</script>
</head>
<style type="text/css">
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 9px;
}
</style>

<body>
<form action="<?php echo $editFormAction; ?>" name="form" method="POST">
<table width="950" border="0" align="left">
  <tr>
    <td align="center"><strong>PROVEEDOR</strong></td>
    <td align="center"><strong>BOL. N&deg;</strong></td>
    <td align="center"><strong>N&deg; OPE</strong></td>
    <td align="center"><strong>FECHA</strong></td>
    <td align="center"><strong>NETO</strong></td>
    <td align="center"><strong>IMP. ESP.</strong></td>
    <td align="center"><strong>IVA</strong></td>
    <td align="center"><strong>TOTAL</strong></td>
    <td align="center"><strong>VERIF IVA</strong></td>
    <td align="center"><strong>VERIF. TT</strong></td>
    <td width="55" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td width="270" align="center">
      <input type="hidden" name="mes_ingreso" id="mes_ingreso" value="<?php echo $mes; ?>"/>
      <input type="hidden" name="nombre" id="nombre" value="<?php echo $row_Recordset2['nombre']; ?>"/>
      <input type="hidden" name="tipo" id="tipo" value="BOLETA HONORARIOS"/>
      <input type="hidden" name="rut" id="rut" value="<?php echo $row_Recordset1['rut']; ?>"/>
      <input type="hidden" name="cv" id="cv" value="<?php echo $row_Recordset1['cv']; ?>"/>
      <input type="hidden" name="proveedor" id="proveedor" value="<?php echo $row_Recordset1['proveedor']; ?>"/>
      <?php echo $row_Recordset1['proveedor']; ?></td>
    <td width="48" align="center">
      <input name="nfact" type="text" id="nfact" size="8" /></td>
    <td width="32" align="center">
      <input name="noper" type="text" id="noper" size="2" /></td>
    <td width="254" align="center">
      <input name="dia" type="text" id="dia" size="1" maxlength="2" value="dd" onclick="if(this.value=='dd') this.value=''" onblur="if(this.value=='') this.value='dd'"/>
      /<input name="mes" type="text" id="mes" size="1" maxlength="2" value="mm" onclick="if(this.value=='mm') this.value=''" onblur="if(this.value=='') this.value='mm'"/>
      /<input name="ano" type="text" id="ano" size="1" maxlength="4" value="aaaa" onclick="if(this.value=='aaaa') this.value=''" onblur="if(this.value=='') this.value='aaaa'"/></td>
    <td width="35" align="center">
      <input name="neto" type="text" id="neto" size="5" onchange="viva()"/></td>
    <td width="40" align="center">
      <input name="imp_esp" type="text" id="imp_esp" onchange="viva()" value="0" size="4"/></td>
    <td width="35" align="center">
      <input name="iva" type="text" id="iva" size="4" onchange="viva()"/></td>
    <td width="40" align="center">
      <input name="total" type="text" id="total" size="6" onchange="viva()" onkeyup="deshabilita(this.form)"/></td>
    <td width="45" align="center">
    <input name='viva1' type='text' id='viva1' size='4' /></td>
    <td width="45" align="center">
      <input name="vtt" type="text" id="vtt" size="4" /></td>
    <td align="center"><input type="submit" name="INGRESA" id="INGRESA" value="Enviar" /></td>
  </tr>
</table>
<input type="hidden" name="MM_insert" value="form" />
</form>
<p>&nbsp;</p>
</body>
</html> 
Necesito saber como puedo hacer para que el boton de envio solamente se active cuando el valor del campo "vtt" sea igual a "0"...

Muchas gracias por la ayuda!!!

Última edición por marce_vampira; 11/01/2013 a las 12:39