Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/03/2013, 08:41
Avatar de IIZeusII
IIZeusII
 
Fecha de Ingreso: febrero-2013
Ubicación: El Olympo
Mensajes: 8
Antigüedad: 11 años, 2 meses
Puntos: 0
Pregunta suma y update de un campo

Buenas tengo un problema espero que me puedan ayudar... Tengo el siguiente código.

Código:
<html>
<head>
<script language="javascript">
function opera(){
    var uno     = document.all.uno.value;
    var dos     = 2;    
    var tres    = document.all.resultado.value =(uno / dos)+ " Cajas ";
}
 
function Checked(input) {
    document.nombreForm.uno.disabled            = false; 
    document.nombreForm.uno.disabled            = !input.checked; 
    
    document.nombreForm.resultado.disabled      = false; 
    document.nombreForm.resultado.disabled      = !input.checked;
 
    if(!input.checked) {
        document.getElementById('uno').value                = 0;
        document.getElementById('resultado').value          = '';
    }
}
 
</script>
</head>
    <body>
        <table border='0' width='100%'>
			<tr bgcolor='#AED0EA'>
			<th width='80' style='text-align: center'>Seleccione</th>
			<th width='206' style='text-align: center'>Medicamento</th>
			<th width='180' style='text-align: center'>Presentacion</th>
			<th width='180' style='text-align: center'>Canje maximo anual</th>
			<th width='200' style='text-align: center'>Cantidad de canjes realizados</th>
			<th width='200' style='text-align: center'>Cajas vacias entregadas</th>
			<th width='240' style='text-align: center'>Cantidad de cajas a entregar</th>
			</tr><tr>
			<td style='text-align: center'><form name='nombreForm' id='form' method='post' />
   <input type='checkbox' name='medicamentos' onclick='Checked(this);'/></td>
			<td style='text-align: center'><? $registros['medicamento'] ?>
			</td>
			<td style='text-align: center'><? $registros['presentacion'] ?></td>
			<td style='text-align: center'><? $registros['max_canjes'] ?></td>
			<td style='text-align: center'><? $registros['canjes'] ?></td>
			<td style='text-align: center'>
  <select name='uno' id='uno' onChange='opera();' disabled>
<option value='0'>Seleccione...</option>
            <option>2</option>
            <option>4</option>
			<option>6</option>
			<option>8</option>
			<option>10</option>
			<option>12</option>
  </select>
  <td style='text-align: center'><input name='tres' type='text' id='resultado' disabled></input>
    </form>
			</tr>
			</table>
<br><center><input name='registro' type='button' id='' value='Registrar canjes'></center>
    </body>
</html>
todo funciona bien, ahora... El problema esta en que al darle al botón quisiera sumar el resultado que obtengo mediante el SELECT al numero que me muestra mediante la consulta en el campo "canjes" y que lo actualice.

Por ejemplo si en el campo de "canjes" me aparece 6 y mediante select el resultado es 4 quisiera que al darle al botón "registrar canjes" me actualice a 10.

Como seria la consulta en este caso?